How to make our own JavaScript library | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 18

How to make our own JavaScript library

Help me

20th Nov 2020, 8:29 AM
Papa Penguin
3 Answers
+ 12
First you have to know abt functions and why we use library While writing js.. On bigger projects we see some repetations of code unnecessary... To overcome that we use functions... Like everytime we write document.querySelector(xyz) Instead we can make a function like function $(query) { return document.querySelector(query) } And eyery time we can say $(xyz) Instead of typing whole Now we need to do this all the time What if we put this function and deploy it somewhere like github Then we can import all this using a link Bingo... Youve created tour first lib https://youtu.be/24GF5MVEEjE You can watch this vid to know more and have a practical example..
20th Nov 2020, 1:40 PM
Shreyansh
Shreyansh - avatar
20th Nov 2020, 9:27 AM
Locus
Locus - avatar
- 1
loom q
5th Mar 2021, 4:47 PM
Saleem Nadaf
Saleem Nadaf - avatar