Thursday, 8 June 2017

Why is this returning a value in javascript's repl?

When I execute this expression in javacsript's repl (browser's console or node)

if(false) {4} else {5}

it returns 5 but I don't understand why.

An if isn't returning anything, for exemple I can't do:

var foo = if(false) {4} else {5}

So why REPL return a value ?



via samuel

No comments:

Post a Comment