<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    var str='123asd';
    //法1
    console.log(typeof str==='string'); //true
    //法2
    console.log(str.constructor===String); //true

    console.log(str instanceof String); //false
    //法3
    console.log(Object.prototype.toString.call(str)==='[object String]')


</script>

</body>
</html>

相关文章:

  • 2022-12-23
  • 2021-05-09
  • 2021-09-28
  • 2022-02-17
  • 2022-01-08
  • 2022-01-07
  • 2022-12-23
  • 2021-10-08
猜你喜欢
  • 1970-01-01
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
  • 2021-08-06
相关资源
相似解决方案