Code Reduction | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Code Reduction

Is there a place where I can go to find custom handy functions I can use to reduce my code? It doesn't have to just be Javascript, just in general really. Handy functions similar to this example: function id(str){ return document.getElementById(str); } //Which allows you to simply get an element by id with reduced code

8th Mar 2017, 2:50 PM
Ghauth Christians
Ghauth Christians - avatar
5 Answers
+ 2
Use a library, for this case (JavaScript) use library like jQuery. syntax to get element by Id. $('#elementId')
8th Mar 2017, 4:08 PM
Eranga
Eranga - avatar
+ 13
@Gavin Christians I'm lost. So, so lost. But I've got to "Just Keep Swimming" šŸ˜
8th Mar 2017, 4:35 PM
Jafca
Jafca - avatar
+ 2
Thanks Eranga F
8th Mar 2017, 4:11 PM
Ghauth Christians
Ghauth Christians - avatar
+ 2
Hey Jafca, did you get a chance to check out my Finding Dory game? :)
8th Mar 2017, 4:14 PM
Ghauth Christians
Ghauth Christians - avatar
+ 2
@Jafca your reply is funny as hell šŸ˜‚
8th Mar 2017, 4:36 PM
Ghauth Christians
Ghauth Christians - avatar