This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setA = new Set(); | |
setA.add("maps").add("filters").add("generators").add("arrow functions"); | |
setA.has(“promises”); | |
setA.has(“generators”); | |
for(const s in setA.values()) | |
document.write(s + "<br/>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setA = new Set(); | |
setA.add(“maps”); | |
setA.add("maps").add("filters").add("generators").add("arrow functions"); | |
setA.delete(“filters”); | |
setA.clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setA = new Set(); | |
setA.add(“maps”); | |
setA.add("maps").add("filters").add("generators").add("arrow functions"); | |
setA.has(“promises”); | |
setA.has(“generators”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setA = new Set(); | |
setA.add(“maps”); | |
setA.add("maps").add("filters").add("generators").add("arrow functions"); | |
console.log(setA.size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var setA = new Set(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var a = 2; | |
var b = 7; | |
var c = 2; | |
document.write("Answer is " + sum()); | |
/* function sum(){ | |
return a+b; | |
} */ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/* initialize and call a function | |
which takes users name in a variable | |
and welcome them on page */ | |
function greetingMessage() { | |
var name = promp("Type your first name."); | |
document.write("Welcome to our page " + name + "!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var x = 5; //declare and initalize the variable x | |
var y = x * 4; //multiply the value of x four times | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//declaring a function to sort numbers | |
function sortNumbers(){ | |
//declare and initialize array of numbers | |
const nums = [3,14,45,12]; | |
//sort the array and display the result | |
document.write(nums.sort()); | |
} | |
sortNumbers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//prints Hello World | |
document.write("Hello World"); | |
</script> |