<!
DOCTYPE html> </body>
<html> </html>
<body> Numbers can be written with, or without
decimals
<h2>JavaScript Strings</h2>
<!DOCTYPE html>
<p>Strings are written with quotes. You can use
single or double quotes:</p> <html>
<p id="demo"></p> <body>
<script> <h2>JavaScript Numbers</h2>
let carName1 = "Volvo XC60"; <p>Numbers can be written with, or without
decimals:</p>
let carName2 = 'Volvo XC60';
<p id="demo"></p>
document.getElementById("demo").innerHTML
= <script>
carName1 + "<br>" + let x1 = 34.00;
carName2; let x2 = 34;
</script> let x3 = 3.14;
</body> document.getElementById("demo").innerHTML
=
</html>
x1 + "<br>" + x2 + "<br>" + x3;
use quotes inside a string
</script>
<!DOCTYPE html>
</body>
<html>
</html>
<body>
Extra large or extra small numbers
<h2>JavaScript Strings</h2>
<!DOCTYPE html>
<p>You can use quotes inside a string, as long
as they don't match the quotes surrounding the <html>
string:</p>
<body>
<p id="demo"></p>
<h2>JavaScript Numbers</h2>
<script>
<p>Extra large or extra small numbers can be
let answer1 = "It's alright"; written with scientific (exponential)
notation:</p>
let answer2 = "He is called 'Johnny'";
<p id="demo"></p>
let answer3 = 'He is called "Johnny"';
<script>
document.getElementById("demo").innerHTML
= let y = 123e5;
answer1 + "<br>" + let z = 123e-5;
answer2 + "<br>" + document.getElementById("demo").innerHTML
=
answer3;
y + "<br>" + z;
</script>
</script>
</body> </body>
</html> </html>
Boolean True Or false Object
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<h2>JavaScript Booleans</h2> <h2>JavaScript Objects</h2>
<p>Booleans can have two values: true or
false:</p>
<p id="demo"></p>
<p id="demo"></p>
<script>
<script>
let x = 5;
const person = {
let y = 5;
firstName : "John",
let z = 6;
lastName : "Doe",
document.getElementById("demo").innerHTML
= age : 50,
(x == y) + "<br>" + (x == z); eyeColor : "blue"
</script> };
</body>
</html> document.getElementById("demo").innerHTML
=
Array
person.firstName + " is " + person.age + " years
<!DOCTYPE html> old.";
<html> </script>
<body>
<h2>JavaScript Arrays</h2> </body>
<p>Array indexes are zero-based, which means </html>
the first item is [0].</p>
<p id="demo"></p>
<script>
const cars = ["Saab","Volvo","BMW"];
document.getElementById("demo").innerHTML
= cars[0];
</script>