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 :)
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()
+ 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.