Hello everyone. JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hello everyone. JavaScript

What does the keywords "public", "protected", "private" do? And also give me example pls

17th Oct 2017, 3:57 PM
๐Ÿ˜Ž_M_๐Ÿ˜Ž
๐Ÿ˜Ž_M_๐Ÿ˜Ž - avatar
6 Answers
+ 3
There are no public, private or advanced variables/functions in Javascript. You are possibly confusing it with other languages.
19th Oct 2017, 12:55 PM
Private [GER]
Private [GER] - avatar
+ 1
JS marks unknown stuff purple.
19th Oct 2017, 1:03 PM
Private [GER]
Private [GER] - avatar
+ 1
Your console also says that private isn't defined.
19th Oct 2017, 1:04 PM
Private [GER]
Private [GER] - avatar
+ 1
Ok, thank you for explanation
19th Oct 2017, 1:05 PM
๐Ÿ˜Ž_M_๐Ÿ˜Ž
๐Ÿ˜Ž_M_๐Ÿ˜Ž - avatar
+ 1
Thanks for marking as right answer :)
19th Oct 2017, 1:15 PM
Private [GER]
Private [GER] - avatar
0
But how would you explain this? Why this words are purple color instead of white? https://code.sololearn.com/WZ3LemLSrtrc/?ref=app
19th Oct 2017, 1:02 PM
๐Ÿ˜Ž_M_๐Ÿ˜Ž
๐Ÿ˜Ž_M_๐Ÿ˜Ž - avatar