<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p id="demo"></p> <script> var x = 'It\'s alright'; var y = "He is called \"Johnny\""; document.getElementById("demo").innerHTML = x + "<br>" + y; </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <script> var txt = "Hello World!"; document.write("<p>" + txt.length + "</p>"); var txt="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; document.write("<p>" + txt.length + "</p>"); </script> </body> </html>
<! DOCTYPE HTML> <HTML> <head> <Meta charset = "UTF-. 8"> <title> novice tutorial (runoob.com) </ title> </ head> <body> <P ID = "Demo"> </ P> <Script> var X = "John"; // X is a string var Y = new new string ( "John"); // Y is a target . document.getElementById ( "Demo") the innerHTML = typeof + X "" + typeof Y; </ Script> </ body> </ HTML>
<! DOCTYPE HTML> <HTML> <head> <Meta charset = "UTF-. 8"> <title> novice tutorial (runoob.com) </ title> </ head> <body> <P ID = "Demo"> </ P> <Script> var X = "John"; // X is a string var Y = new new string ( "John"); // Y is a target . document.getElementById ( "demo") innerHTML = x = == Y; </ Script> <P> === absolute equal, i.e., data type and value must be equal. </ P> </ body> </ HTML>