Javascript considers most data types to be ‘primitive’, these data types are immutable, and are passed by value. The more complex data types: Array and Object are mutable, are considered ‘reference’ data types, and are passed by reference.
let obj = { "one": 1, "two": 2 };
// Choose the square brackets property accessor when the property name is determined at
// runtime, or if the property name is not a valid identifier
let myKey = "one";
console.log(obj[myKey]);
// Choose the dot property accessor when the property name is known ahead of time.
console.log(obj.two);
let keyName = "two";
// If the key is not known, you can use an alternative `[]` syntax for
// object initialization only
let obj2 = { [keyName]: 2 }
console.log(obj2);
function doesKeyExist(obj, key) {
// obj[key] !== undefined
// or:
return key in obj;
}
let course = { bootcamp: 'App Academy', course: 'Bootcamp Prep' }
console.log(doesKeyExist(course, 'course')); // => true
console.log(doesKeyExist(course, 'name')); // => false
function printKeys(object) {
return Object.keys(object);
}
function printValues(object) {
return Object.values(object);
}
console.log(printKeys({ dog: "Strelka", dog2: "Belka" }));
console.log(printValues({ dog: "Strelka", dog2: "Belka" }));
let player = { name: "Sergey", skill: "hockey" };
for (let key in player) {
console.log(key, player[key]);
}
console.log(Object.entries(player));
function restSum(...otherNums) {
let sum = 0;
console.log(otherNums);
otherNums.forEach(function (num) {
sum += num;
});
return sum;
}
console.log(restSum(3, 5, 6)); // => 14
console.log(restSum(1, 2, 3, 4, 5, 6, 7, 8, 9)); // => 45
console.log(restSum(0)); // => 0
let numArray = [1, 2, 3];
let moreNums = [...numArray, 4, 5, 6]
console.log(moreNums);
let shoe = { color: "red", size: 10 };
let newShoe = { ...shoe, brand: "Nike", size: 12 };
console.log(newShoe);
newShoe.color = "black";
console.log(newShoe);
console.log(shoe);
let me = {
name: "Ian",
instruments: ['bass', 'synth', 'guitar'],
siblings: {
brothers: ['Alistair'],
sisters: ['Meghan']
}
}
let { name, instruments: musical_instruments, siblings: {sisters}} = me;
console.log(name);
console.log(musical_instruments);
console.log(sisters);
function charCount(inputString) {
let res = inputString.split("").reduce(function(accum, el) {
if (el in accum) {
accum[el] = accum[el] + 1;
} else {
accum[el] = 1;
}
return accum;
}, {})
return res;
}
console.log(charCount('aaabbbeebbcdkjfalksdfjlkasdfasdfiiidkkdingds'));
Driver - has complete control of the keyboard and mouse, little or no input on the code output on the screen
Navigator - has no control of the keyboard and mouse, has majority or all input on the code that is output on the screen
Empathetic communication is communication that takes into account what we do, the way we do it, and our impact on other people. As this awareness grows, we create better connections more quickly and find ourselves more motivated and willing to respond in any situation.
“You are not your code” - You may be an excellent programmer. But do people want to work with you? You may write bad code and still be an awesome person. People will gravitate towards those with excellent communication skills. Maintaining a positive and friendly attitude will lead to better collaboration and long term connections.
Note: If you are both stuck and need a few extra minutes to talk about implementation, pause the timer, talk it through, and then start again!
In a technical interview, you’re going to have to explain your thought process when solving an algorithm or talking about system design. Getting the correct answer to the algorithm isn’t always what the interviewer is looking for. The question may be very abstract and your line of questioning/communicating might be what pushes you to the next round of interviews. Having excellent verbal and interpersonal skills will have the interviewer rooting for you to succeed.