console.log(square(5));
function square(n) {
return n*n;
}
- Error
- 25
An explanation of JavaScript's pass-by-value, which is unlike pass-by-reference from other languages.
const bottleManagement = { | |
bottles: {}, | |
nextId: 0, | |
addBottle: function (newBottle){ | |
newBottle.key = this.nextId | |
this.bottles[this.nextId] = newBottle; | |
this.nextId++; | |
return this.nextID - 1; | |
}, | |
getBottle: function(id){ |
var app = { | |
db: {}, | |
next_id: 0, | |
create: function(newThing) { | |
// this.db[this.next_id] = newThing; | |
// this.next_id ++; | |
if(newThing !== ''){ | |
this.db[this.next_id] = newThing; | |
this.next_id ++; | |
console.log("THING WAS ADDED") |
function challenge1 (a, b, c){ | |
let base1 = Number.parseInt(a, b); | |
let base2 = Number.parseInt(base1, c); | |
return base2.toString(); | |
} | |
console.log(challenge1 (10, 2, 10)) | |
function tripledouble(num1, num2) { | |
var check1 = ''; | |
var check2 = ''; | |
if (typeof num1 !== 'number' || typeof num2 !== 'number'){ | |
return 0; | |
} | |
var a = num1.toString().split(''); | |
var b = num2.toString().split(''); | |
for (var i = 0; i < a.length; i++){ |