r.dbCreate('mydb')
This file contains hidden or 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
class ProductCost { | |
constructor(item,quantity,price) { | |
this.item = item; | |
this.quantity = quantity; | |
this.price = price; | |
} | |
//getter | |
get cost() { | |
return this.calcCost(); | |
} |
This file contains hidden or 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
//create a new generator function called takeOff | |
function* takeOff(){ | |
yield "Three"; | |
yield "Two"; | |
yield "One"; | |
yield "Space Craft taking off....." | |
} | |
//assign takeOff to a funtion expression named countDown | |
const countDown = takeOff(); |
This file contains hidden or 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
//Create a generator function to display some popular JS frameworks/libraries | |
function* displayFrameworks(){ | |
const javascriptFrameworks = ['Angular','React','Vue']; | |
for(let i=0;i < javascriptFrameworks.length;i++){ | |
yield javascriptFrameworks[i]; | |
} | |
} | |
const listFW = displayFrameworks(); // Generator { } |
This file contains hidden or 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
const myLaptopObject = { | |
name : "Dell", | |
color : "black", | |
weight : 3.75, | |
working : true, | |
start : function (){ | |
//function (i.e method) to power up device goes here | |
}, | |
increaseVolume : function (){ | |
//function(i.e method) to increase volume goes here |
OlderNewer