10道恶心的js数据类型转换面试题

405 阅读1分钟
1. !(!"Number(undefined)");

2. isNaN(parseInt(new Date())) + Number([1]) + typeof undefined;

3. Boolean(Number("")) + !isNaN(Number(null)) + Boolean("parseInt([])") + typeof !(null);

4. parseFloat("1.6px") + parseInt("1.2px") + typeof parseInt(null);

5. isNaN(Number(!!Number(parseInt("0.8"))));

6. console.log(1 + "2" + "2");

7. !typeof parseFloat("0");

8. Number("");

9. typeof "parseInt(null)" + 12 + !!Number(NaN);

10. !typeof (isNaN("")) + parseInt(NaN);

11. typeof !parseInt(null) + !isNaN(null);

答案在下一节!!!