Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion bike-shop/src/stage1-literals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
const myBike = {
// your code here
name: 'Roadster',
price: 199.99,
frame: {
height: 55,
color: 'blue',
style: 'cruiser'
},
brakes: {
front: false,
back: true
},
tires: {
diameter: 22,
type: 'fat'
},

rings: [2, 5],

}


module.exports = myBike
20 changes: 20 additions & 0 deletions jsinfo/Create_calculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//Create Calculator

let calculator = {

read() {
this.num1 = +prompt('num1?');
this.num2 = +prompt('num2?');
},
sum() {
return this.num1 + this.num2;
},

mul() {
return this.num1 * this.num2;
},
};

calculator.read();
alert( calculator.sum() );
alert( calculator.mul() );
8 changes: 8 additions & 0 deletions jsinfo/Hello_Object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//Hello Object

let user = {}
user.name: 'John';
user.surname: 'Smith';
user.name = 'Pete';

delete user.name
17 changes: 17 additions & 0 deletions jsinfo/Ladder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//Ladder

let ladder = {
step: 0,
up() {
this.step++;
return this;
},
down() {
this.step--;
return this;
},
showStep: function() { // shows the current step
alert( this.step );
return this;
}
};
26 changes: 26 additions & 0 deletions jsinfo/Multipy_numeric_properties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//Multipy Numeric Properties by 2

// before the call
let menu = {
width: 200,
height: 300,
title: "My menu"
};

multiplyNumeric(menu);

function multiplyNumeric() {
for ( let key in obj ) {
if (typeof obj[key] == 'number') {
obj[key] *= 2;
}
}
}


// after the call
menu = {
width: 400,
height: 600,
title: "My menu"
};