コードを編集:
結果を参照してください。 »
それを自分で試してみてください - ©
w3ii.com
<
!DOCTYPE
html
>
<
html
>
<
body
>
<
p
id
="demo"
>
<
/p
>
<
script
>
var
x =
"John"
;
// x is a string
var
y =
new
String(
"John"
);
// y is an object
document.getElementById(
"demo"
).innerHTML =
typeof
x +
"<br>"
+
typeof
y;
<
/script
>
<
/body
>
<
/html
>
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var x = "John"; // x is a string var y = new String("John"); // y is an object document.getElementById("demo").innerHTML = typeof x + "<br>" + typeof y; </script> </body> </html>