I have this Coffeescript:
console.log 'TEST'
console.log index
console.log (index is not 0)
console.log (index > 0)
unless index is 0
console.log "passed test"
This is the compiled Javascript:
console.log('TEST');
console.log(index);
console.log(index === !0);
console.log(index > 0);
_results.push(index !== 0 ? console.log("passed test") : void 0);
This is the console output
TEST
0
false
false
passed test
TEST
1
false
true
passed test
Question 1) Why does (index is not 0) return false when index is 1? (index > 0) returns true for 1, so why doesn't (index is not 0)?
Question 2) Why does the unless index is 0 test get passed when index is 0?