I recently learned a difference between Primitive types and Reference types.
I thought it would be great to write a blog post about this topic.
...
For further actions, you may consider blocking this person and/or reporting abuse
There is no pass by reference in this article.
Not pass by (no functions in this article) but it's basically the same principle for types and assigning objects to new variables- still just a reference
Not in the least.
What does this print?
Which of your images does it reflect?
An error. That is syntactically wrong
Try now ;)
Nice write up! I wouldn't call these behaviors weird though, this is by far the least weird behavior of JavaScript
Thanks, you're right this is not that weird, i wanted to make this as a series, i don't know what i will post next but i definitely consider "why 0.1 + 0.2 = 0.30000000000000004" which is lot weirder than this
It is weird. I'd love to know more about this!
It's not that weird actually. It's just how computers handle floating numbers.
Excerpt from this post: docs.oracle.com/cd/E19957-01/806-3...
Really interesting read, I had not read much about this whole topic!
Yeah, it feels weird when you see it first, after you've learned how numbers work in JavaScript, everything makes sense.
youtube.com/watch?v=MqHDDtVYJRI
This video really helped me to grasp how numbers work in JavaScript,.
This looks really interesting I will read this, thanks.
Could you point out where 'reference types' are mentioned in the ecmascript spec?
I can't find it anywhere in the language specification.
es5.github.io/#x8.7 this might help
It would if it talked about object references.
The references mentioned there are property references.
For example, in delete a.b; a.b is a reference.
"The Reference type is used to explain the behaviour of such operators as delete, typeof, and the assignment operators."
Can you find anything about 'reference types' that's relevant to object values or anything mentioned in this article?
To be specific, anywhere that supports the claim that objects, functions, and arrays are reference type values.
Hi, I realized that you're looking for a job! We're hiring. But I could not see any information to contact with you. Can you please share an information to contact with you? :)
Very helpful and informative article, thank you for posting that.
Thank you for your polite comment.