2021-02-24js learning-data type conversion

problem:

  1. How is the Boolean type + number type data operated?
  2. undefined+string result?
  3. Undefined+number, boolean result
  4. NuLL and string splicing results
  5. Null and numeric results?
  6. Null+Boolean result?
  7. What method is used to detect the data type?
  8. How to convert other data types to string types?
  9. Convert other types of data to digital?
  10. Convert other data types to boolean values?
  11. '' ,0,NaN,null,undefined What is converted into using Boolean()

Reply:

  1. How is the Boolean type + number type data calculated?
    a) True is regarded as 1, false is regarded as 0
  2. undefined+string result?
    a) It is equivalent to the splicing method of strings.
  3. Undefined+number, boolean result?
    a) NaN
  4. NuLL and string splicing results
    a) Null string
  5. Null and number result?
    a) Number
  6. Null+Boolean result?
    a) Convert the Boolean value to a numeric value.
  7. What method is used to detect the data type?
    a) Typeof
  8. How to convert other data types to string types?
    a) toString().
    b) String()
    c) String+'+'
  9. Convert other types of data to numeric type?
    a) ParseInt(String)
    b) parseFloat(string)
    c) Number()
    d)-* /
  10. Convert other data types to boolean values?
    a) Boolean()
  11. '' ,0,NaN,null,undefined What does Boolean() convert into?
    a) False,
    b) Everything else is true

Guess you like

Origin blog.csdn.net/weixin_44767679/article/details/114017696
Recommended