Why 1 + + "2" = 3?

> 1+ +"2"
< 3

how does solving this code work? What is the role of spaces?

in addition, what is the principle of the process of solving false==null why it is false,?

Thank you ~

Mar.25,2021

  1. + "2" transforms to 2
  2. null==undefined, they only have this kind of relationship, which is different from the others.

keyword implicit type conversion .


clipboard.png

clipboard.png


+ "2" = > 2 / / A way to convert a string into a number, and then 1 / 2 / 3
as for false==null, you'd better look at the basics


implicit type conversion. You can check out the "JavaScript you don't know" series


  1. spaces are converted to 0;
    '2' is converted to 2.
  2. when comparing equality, Boolean operands are first converted to numeric values-- false is converted to zero, true is converted to 1;
    null and undefined are not converted to any other values when comparing equality. Null = = undefined returns true, but null = undefined returns false
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36890-e56f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36890-e56f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?