-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.js
More file actions
85 lines (62 loc) · 2.03 KB
/
Copy pathstring.js
File metadata and controls
85 lines (62 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
let text = "John Doe";
console.log(text);
let carName1 = "Volvo XC60"; // Double quotes
let carName2 = 'Volvo XC60'; // Single quotes
console.log("carName1:", carName1);
console.log("carName2:", carName2);
let answer1 = "It's alright";
let answer2 = "He is called 'Johnny'";
let answer3 = 'He is called "Johnny"';
console.log("answer1:", answer1);
console.log("answer2:", answer2);
console.log("answer3:", answer3);
let text2 = `He's often called "Johnny"`;
console.log("text2:", text2);
let text3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let length = text3.length;
console.log("Length of text3:", length);
//let text4 = "We are the so-called "Vikings" from the north.";
let text4 = "We are the so-called \"Vikings\" from the north.";
console.log("text4:", text4);
let text5= 'It\'s alright.';
console.log("text5:", text5);
let text6 = "The character \\ is called backslash.";
console.log("text6:", text6);
let text7 =
`The quick
brown fox
jumps over
the lazy dog`;
console.log("text7:", text7);
let x = "John";
let y = new String("John");
console.log("x == y:", x == y); // true
console.log("x === y:", x === y); // false
console.log("Type of x:", typeof x); // string
console.log("Type of y:", typeof y); // object
let x2 = new String("John");
let y2 = new String("John");
console.log("x2 == y2:", x2 == y2); // false
console.log("x2 === y2:", x2 === y2); // false
console.log("===================================");
let firstName = "John";
let lastName = "Doe";
let text8 = `Welcome ${firstName}, ${lastName}!`;
console.log("text8:", text8);
let a = 5;
let b = 10;
let text9 = `${a + b} is the sum of ${a} and ${b}.`;
console.log("text9:", text9);
let price = 10;
let VAT = 0.25;
let total = `Total: ${(price * (1 + VAT)).toFixed(2)}`;
console.log("total:", total);
let header = "Template Strings";
let tags = ["template strings", "javascript", "es6"];
let html = `<h2>${header}</h2><ul><br/>`;
for (const x of tags) {
html += `<li>${x}</li><br/>`;
}
html += `</ul><br/>`;
console.log("html:", html);
console.log("===================================");