+ 1

JavaScript | functions are named with reserved keywords

I'm watching a video on Revealing Module Pattern and the instructor named some of his functions with "add" and "get" and I'm super confused because I thought those words are reserved(add is used for Sets and get is used to return elements from Map objects). So how come this allowed? https://code.sololearn.com/WISc4KSB1K6G/?ref=app

17th May 2018, 9:18 PM
Caleb Taylor
Caleb Taylor - avatar
1 Réponse
0
add and get aren't reserved in JavaScript, but get is reserved in C#, Java, C++ etc.. In JavaScript It's allowed to define a function like "get" or "add". But you're right, It's dangerous to use names like these.
18th May 2018, 7:56 PM
David
David - avatar