1// in your string you can call your variable like ${myVar}. eg:
2var myVar = "blue";
3console.log("The sky is " + myVar + ".");
4// Output: "The sky is blue."
1var a = 1;
2var b = 2;
3console.log(`the sum of a and b is ${a+b}`)
4//the sum of a and b is 3
5Note: `` also works for multi-line strings:
6`hi
7this
8is
9a
10multi-
11line
12string!
13`
14whereas "" cannot do multi-line
15"this line is highlighted
16this line isnt"
1<html>
2 <head>
3 <title>JavaScript Strings</title>
4 </head>
5 <body>
6 <script>
7 var re = "java";
8 var str = "Learn java";
9 if ( str.search(re) == -1 ){
10 document.write("Not found!" );
11 } else {
12 document.write("Found!" );
13 }
14 </script>
15 </body>
16</html>