0

How can I make my code shorter?

https://code.sololearn.com/Wa4EHkoa570P/?ref=app I’m trying to make this program where you answer a couple questions and then it recommends you some TV shows, but i feel like it requires too much code the way I’m doing it. Do you guys have any tips on how to make it shorter? Also, if you have any other feedback on my code, please let me know :)

5th Aug 2020, 1:56 PM
GiuMar
GiuMar - avatar
2 Answers
+ 2
One way would be removing all those const declarations and using something else instead: What I use: var $ = (id) => document.getElementById(id); then you just type $("your element's id).whatever_u_want()
5th Aug 2020, 2:27 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 1
Use array of objects to store que and ans . It will shorten your html codes if you have various question. Check such projects in codes .search for quiz there.
5th Aug 2020, 2:36 PM
Divya Mohan
Divya Mohan - avatar