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 tim = 'mit'; |
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
function constructor(name) { | |
new_obj = {}; | |
new_obj.__proto__ = constructor.prototype; | |
new_obj.name = name; | |
return new_obj; | |
} | |
constructor.prototype = {}; | |
constructor.prototype.age = 9; |
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
function assign_as_cloner(target_obj, source_obj) { | |
return Object.assign({}, target_obj, source_obj) | |
}; | |
function assign_as_modifier(target_obj, source_obj) { | |
Object.assign(target_obj, source_obj); | |
}; | |
// https://javascript.info/object#copying-by-reference |
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 calc = { | |
lastResult: 0000, | |
operate: function(operation, arg1, arg2) { | |
switch(operation){ | |
case "add": | |
if(arg2){ | |
calc.lastResult = calc.add(arg1, arg2); | |
return this.lastResult; |
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
function isIsogram(str){ | |
let returner = true; | |
let table = {}; | |
/* iterate through string | |
count every time we see a letter | |
the second time you see a letter, return false */ | |
/* for letter in string | |
count every time we see a letter |
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
function solution(str) { | |
if (str.length % 2 == 0) { | |
let length = str.length; | |
for (let i = 0; i <= length/2; i++ ) { | |
let holder = str[i]; | |
str[i] = str[length - i] | |
str[length - i] = holder; | |
}; | |
} | |
else { |
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
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++){ |
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
let number = { | |
value: 0, | |
decrement: function() { | |
this.value = this.value - 1; | |
return this.value + 1; | |
}, | |
increment: function() { | |
this.value = this.value + 1; | |
return this.value -1; | |
} |
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
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)) | |
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
// https://github.com/Mariana88/binary-addition | |
// her code for binary addition | |
// it's so long since she constrained herself to using only strings | |
// this makes binaryStrAddition long, | |
// she had to do logical comparisons between strings | |
// rather than simply pulling out elements | |
// it doesn't work with negative numbers, but that's not important for this execise | |
// we looked at how she split her primary strategy (binaryAddition) into two sub-procedures |
OlderNewer