+ 1

How can I make the Social Security Number Property Private from other Objects?

https://code.sololearn.com/We5bqbl6sEQ5/?ref=app In my code there are two objects. One is a person with a first and last name and a made up SSN. The other object is a thief who wants to steal it and sell it over to the console. As the programmer, I cannot allow this to happen. I want to make the person’s SSN property private, while keeping his names public so other people objects may call him by his name. I’ve been stuck on this problem and have not yet found a way to make the property private or do something similar. Please help!

30th Mar 2019, 7:20 PM
Thomas Czernek
Thomas Czernek - avatar
1 Odpowiedź
+ 2
Thomas Czernek This is a very interesting question! I would also like to know how it can be done in JS. Unfortunately I don't have an answer to it, but I found something that might be helpful: https://www.crockford.com/javascript/private.html
31st Mar 2019, 10:11 PM
Pete Wright
Pete Wright - avatar