Sai gowtham Posted on Jul 19, 2018 JavaScript Quiz Part 3 #webdev #javascript #challenge If you miss the part 1 and part 2 check out part1,part2 [ ]+{ } [ ]+0 { }+1 [ ]-0 Top comments (8) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Collapse Expand Arne Mertz Arne Mertz Arne Mertz Follow A Clean Code enthusiast and connoisseur of modern and maintainable C++. Blogger and occasional speaker about both. Location Hamburg, Germany Work Expert Software Engineer at Zühlke Joined Jan 21, 2017 • Jul 20 '18 Dropdown menu Copy link Hide WAT That's all there is to say about those things... See this brilliant talk: destroyallsoftware.com/talks/wat Collapse Expand kip kip kip Follow 404 bio not found ... yet Joined Jan 25, 2018 • Jul 19 '18 • Edited on Jul 19 • Edited Dropdown menu Copy link Hide Try with this too: [1] - 0 [1] + 1 [1] - 1 [1, 2] - 0 1 + {} [1] + {} Collapse Expand Afroze Kabeer Khan. M Afroze Kabeer Khan. M Afroze Kabeer Khan. M Follow Full stack Developer. Node Js, JavaScript & React Email droidmakk@gmail.com Location Chennai, IN Education Engineering Graduate Work Fullstack Developer Joined Mar 26, 2018 • Jul 19 '18 Dropdown menu Copy link Hide I Suspected but got wrong. I got it right Never expected that to happen Obviously i expected Collapse Expand Antoine Mesnil Antoine Mesnil Antoine Mesnil Follow I am a senior web and mobile developer and I am currently building my own startup studio Location Bordeaux, France Education MS Computer Science / Machine Learning Work Freelance Joined Mar 12, 2018 • Jul 20 '18 Dropdown menu Copy link Hide Wrong on the first one, definitly not expected that. Collapse Expand Antony Garand Antony Garand Antony Garand Follow Security enthusiast, FullStack developer, challenge solver Joined Jun 9, 2018 • Jul 27 '18 Dropdown menu Copy link Hide How about []+{} == {}+[]? Collapse Expand Valentin Baca Valentin Baca Valentin Baca Follow Sr. Software Engineer & Tech Lead. 10+ years of experience, primarily at Amazon.com. Currently at Relief.app My opinions are mine. Location Seattle, WA Education B.S Computer Science & B.S. Electrical Engineering from Texas Tech University Work Tech Lead at Relief.app Joined Apr 10, 2017 • Jul 20 '18 Dropdown menu Copy link Hide My answers, 50%: [{}] // Wrong [0] // Wrong 1 // Right 0 // Right Collapse Expand Chirag Shah Chirag Shah Chirag Shah Follow Joined May 9, 2018 • Jul 20 '18 Dropdown menu Copy link Hide How does this happen? Can anyone explain? :O Collapse Expand Antony Garand Antony Garand Antony Garand Follow Security enthusiast, FullStack developer, challenge solver Joined Jun 9, 2018 • Jul 27 '18 Dropdown menu Copy link Hide The + operator can either concatenate two elements or perform an addition. In the first case, it will convert both elements to strings, the array being an empty string and the second one being [Object object]. Second does pretty much the same thing, [] = '', 0 = '0', '' + '0' = '0' And the others are similar. Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (8)
WAT
That's all there is to say about those things... See this brilliant talk:
destroyallsoftware.com/talks/wat
Try with this too:
Wrong on the first one, definitly not expected that.
How about
[]+{} == {}+[]
?My answers, 50%:
How does this happen? Can anyone explain? :O
The
+
operator can either concatenate two elements or perform an addition.In the first case, it will convert both elements to strings, the array being an empty string and the second one being
[Object object]
.Second does pretty much the same thing,
[] = '', 0 = '0', '' + '0' = '0'
And the others are similar.