0

In the tutorial sayed the primitive values can't change,but it can change actually!!!why?

for example: var a = 5; a=3; the output is 3,so I think it's changed! isn't it?😞

22nd Feb 2017, 10:21 AM
Seyed Ebrahim Khadem
Seyed Ebrahim Khadem - avatar
3 Respuestas
+ 1
It changed because you have assigned to the variable another value different from the previous one. May be I did not understand your question. Could you be more clear?
22nd Feb 2017, 1:39 PM
Africa Santos
+ 1
in JavaScript,we have primitive values, primitive values are those values that cannot change.but when i assign a new value to the variable,the value will change.i confused about that!!
22nd Feb 2017, 3:14 PM
Seyed Ebrahim Khadem
Seyed Ebrahim Khadem - avatar
+ 1
I think you have a misunderstanding between primitive values and variables, I hope this documentation could help you https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Primitive_values
22nd Feb 2017, 3:20 PM
Africa Santos