Is the return type of the innerHTML property of type String?

console.log(typeof eleInner);  string,
console.log(eleInner instanceof String);false
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    

HelloWorld

<script type="text/javascript"> var eleP = document.querySelector("p"); var eleInner = eleP.innerHTML; console.log(typeof eleInner); //string console.log(eleInner instanceof String); //false </script> </body> </html>

eleInner is only a value with String as the data type and does not belong to an instance of the String object.

clipboard.png


string is the built-in string type of js; String is a function.

so a value of type string is not an instance of String


this has a Lei Feng relationship with innerHTML.

  https://www.ibm.com/developer.

Menu