how to convert boolean to number in javascript code example Example: javascript cast bool to int + true; // 1 + false; // 0