Issue with JS Challenge Question by K Akbas
Anyone see a flaw in my explanation here? - See link below to run this code: https://code.sololearn.com/WnRpPSE068t9/#html ----------------------------------------- * JavaScript Question by K Akbas: * ----------------------------------------- What is the output of this code? var a = {}, b = {}; console.log(a === b || 0); a = b = {}; console.log(a === b); ----------------------------------------- * Answer provided by K Akbas: * ----------------------------------------- 01 ----------------------------------------- * Issues with the author's answer: * ----------------------------------------- 1. The console.log() method will split the answer to separate lines in the console rather than combine the output to a single line as suggested by the author. - The author should have used the document.write() method to produce an answer with output on the same line. 2. The 2nd output from console.log(a === b) will result in "true" instead of "1". - The author may have been thinking of how booleans are handled in PHP. ----------------------------------------- * Correct answer should have been: * ----------------------------------------- 0 true -----------------------------------------