+ 3
Sweet lord. That's not what I'm talking about. x is a string, right? String is a primitive datatype, so it cannot have properties (such as y). It doesn't matter what datatype would y be, strings still cannot have properties
29th Jun 2019, 8:44 PM
Airree
Airree - avatar
+ 4
Because you are trying to access a property of an object that isn't in object format. Try something like this: Var x = {}; X.norm = "hello"; X.y = 8865;
30th Jun 2019, 1:00 PM
SapphireBlue
SapphireBlue - avatar
+ 3
It's because primitive datatypes cannot have properties. Adding a property to it doesn't magically make it an object, because then what do you do with the initial value?
29th Jun 2019, 8:13 PM
Airree
Airree - avatar
+ 3
String: primitive (simple) Object: not primitive (not simple) Object: has properties String: doesn't have properties Can't add properties to strings, because it's primitive (not object)
29th Jun 2019, 8:22 PM
Airree
Airree - avatar