Question: While parsing the inputs i came across this behaviour of javascript

if you parse a number 

```
console.log(parseFloat('562.0') ? 'true' : 'false') 
console.log(parseInt('562') ? 'true' : 'false') 

```

It returns true, but if i parse 0 

```
console.log(parseFloat('0.00') ? 'true' : 'false') 
console.log(parseInt('0') ? 'true' : 'false') 

```

it returns false

can any one please explain why this happens ??

Answer: 
When you use the conditional operator `? :`, according to [ECMA-262 §11.12](http://www.ecma-international.org/ecma-262/5.1/#sec-11.12), the first operand (in your case it's the `Number` returned by`parseInt` or `parseFloat`) is converted to `Boolean`.

Conversion goes according to [ECMA-262 §9.2](http://www.ecma-international.org/ecma-262/5.1/#sec-9.2), which says

> 
> Number - The result is false if the argument is +0, −0, or NaN; otherwise the result is true.
> 
> 
> 

That's why your expressions with 562 evalute to true, and expressions with 0 evalute to false.
0 and 1 is boolean. <http://en.wikipedia.org/wiki/Boolean>

```
console.log((true)+0); // 1
console.log((false)+0); // 0

```

Zero is the only number returns false.

```
console.log((1) ? "true" : "false"); //true
console.log((0) ? "true" : "false"); //false

```