You can use either double or single quotes to declare a string.
"Hello world!" // declaring with double quotes 'Hello world!' // with single quotes 'She said, "she said"' // Using double quotes within single quotes "She said, \"Hello darling\"" // Escaping quotes with a backslash
As you can see in the above example, you can use the backslash key
\" to escape the quote.
document.write("\tHello\nWorld!"); // Hello // World!
var greeting = "Hello" + "world!";
When adding numbers and strings together, you will get a string back, with the two values concatenated.
var cost = '8' + 9; // cost = '89';
The String object comes with a number of member attributes.
var sample = "Hello there." sample.length; // 12 characters sample.substring(0,5); // "Hello" sample.toUpperCase(); // "HELLO THERE."
To get input from your user, use the
prompt() method. This will display a dialog box to the user, displaying the string passed in as an parameter to
This book teaches HTML as if it's for anyone - hobbyists, students, and professionals - and it's full-color throughout. It utilizes information graphics and lifestyle photography to explain the topics in a simple way that is engaging. You can progress through the chapters from beginning to end or just dip into topics of particular interest at your leisure.$ Check price
Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.$$ Check price