1.
const myString = 'Hello 2020';
myString = 'Hello World!';
console.log(myString)//"Hello World!"
what block scope keyword when changed produces the above console.log output?
2
let students = 0;
let classroom = false;
if(students > 10) {
let classroom = true;
}
console.log(classroom);
What is console-.log'd? (false or true)
3
let num1 = [1,2,3,4];
let num2 = [10,20,30,1];
let num3 = [100,200,300,1];
Find the common elements in all 3 arrays
4
function checkout(price,___){
if(price > 100){
___( ____ );
}
}
function _____( ____){
let discount = ____ - (.10 *_____);
console.log("the total is" + discount)
}
checkout(110,cb);
5
const yummies = ['Ice-cream','Cupcake','Donut','Cupcake'];
Using filter( ), return the unique elements from "yummies"
6
Code a function that returns a promise
7
const composers = [{
Name: 'Beethoven',
Genre: 'Classical',
Rating: '9'
},
{
Name: 'Mozart',
Genre: 'Classical',
Rating: '10'
}]
Use map () to create a new array of objects with the rating & last name
8
let c = 0;
let d = false;
console.log(c !== d);
9
let catPowers ={
snarky: true,
napzinger: "Zzzzz",
gobbler: function(){
if(this.snarky === true)
return this.snarky;
}
}
return only the values of the catPowers object without using for-in
10
let numArray1 =[1,2,3];
let numArray2= numArray1;
numArray2.push(4);
Take a guess what will console.log(numArray1) be?
11
What #ES6 method will you use to create a shallow-copied array of characters from this string referenced by let myString?
let myString = ? ("supercalifragilisticexpialidocious");
12
let obj1 = { a: 10, b:20, c:30 };
let obj2 = { d: 40, e:50, f:60};
let obj3 = { g: 70, h:80, i:90 };
let obj;
Assign all properties from obj1,obj2, obj3 to obj
13
let devFood = [ "Foo Bar", "Barzinga","Loodles"];
console.log(devFood)//["Foo Bar", "Foo Bar", "Barzinga"];
Use an #ES6 method to copy array elements to match the console.log
14
var helloWorld = function(msg){
alert(msg);
}
helloWorld('Hello World');
Re-write this using functional #javascript
15
let games = ["King's Quest", "Super Mario", "Zelda", "Contra"];
games.splice(2, 0, "Doom", "World of Warcraft");
games.slice(0,2);
console.log(games); // ? What will this be
16
what is the difference between the pass by value and pass by reference with examples
17
βinnerHTMLβ can increase the possibility of a XSS attack. What is an alternative for setting text?
18
What is the difference between a π¬ReferenceError and undefined error π‘
19
for (var i = 0; i < 10; i++) {
setTimeout(function(){
console.log(i); //what is logged here?
}, i * 1000 );
}
20
let num = 10;
function sum( ) {
let num = 100;
document.getElementById('myP').innerHTML =(num+num); // 20 or 200?
}
sum( );
21
console.log(false != '0')
console.log(false !== '0')
22
let x = null;
/*Knowing that typeof(x) will return βobjectβ. How do you check for a null value?*/
23
let langs = ["JavaScript","C#","Rust","C++","Python"];
delete langs[3];
console.log(langs.length);//βοΈ
console.log(langs[3]); //βοΈ
24
let arre= ["","A",9,"C++",false];
//Empty the above array
25
let myQueue = [];
myQueue.push('a');
myQueue.push('b');
myQueue.push('c');
//Remove the first element in myQueue. πHINT: FIFO principle
26
console.log(null == undefined) // T or F?
console.log(null === undefined)// T or F?
console.log(typeof(null) === 'object')// T or F?
27
Using in-built methods, implement a stack in #JavaScript and remove the last 2 elements
28
What is event bubbling?π¨οΈ
Is "false" false?π»
Is " " false?π»
How do you increase page load times?π»
29
let person1 = {
name: "Rocko"
};
let person2 = {
name: "Rover"
};
Object.freeze(person1);http://person1.name = "Lara";
person2 = person1;
console.log(person1);
console.log(person2);
30
let fooBar = new Array(5);
fooBar[2] = "Hello";
console.log(fooBar); //
31
let myArr = [1,10,100,1000,10000]
Array.prototype.first = function() {
return this[0];
}
myArr.pop();
console.log(myArr.first()); // ?π«
console.log(myArr); //? π«
32
What is a closure? Give an example
33
let x = y = 7;
y= 10;
console.log(x);
console.log(y);
34
let game1 = "The Legend of JavaScript";
var game2 = "JortNite";
const game3 = "Super Jario";
console.log(window.game1);π
console.log(window.game2);π
console.log(window.game3);π
35
function* generator(num) {
yield num;
yield num * 10;
}
let result = generator(100);
console.log(π«);// 100
console.log(π«); //1000
36
function factorial(num) {
if (num === 0) {
return 1;
} else {
return num* π(num - 1); //replace the star..
}
}
console.log(factorial(4));
37
Write a function to console.log the sum of all the elements in an array using recursion
38
console.log(105 < 232 < 350);
console.log(450 > 333 > 120);
39
//replicate without 'class':
class coder{
constructor(name){
http://this.name =name;
}
detail(){
return(http://this.name );
}
}
40
functionπ»(i) {
let π’= function() {
i++;
};
return π’;
}
let π = π»(1000);
let π = π»(1)
π(); //?
π(); //?
41
let π = new Set();
π.add(1);
π.add(5);
π.add(1,5)
π.add(1, 1000)
console.log(π.size); // βοΈ
42
let π = [
[35, 28, 29, 31],
[33, 24, 25, 29]
];
console.log(π [0][2]);
A. 35,28
B. 33, 25
C. 29
43
const πΈ= (user, newUser) => {
return new Promise ((resolve, reject) => {
if(user === newUser) {
resolve();
} else {
reject();
}
})
}
44
/*Re-write this fxn without using an immediately invoked function (with the same functionality):*/
(function IIFE(){
console.log( 'hello world!' );
})();
45
const animals = [βπ¦β, βπΈβ, βπΉβ, βπ°β];
animals.length = 10;
console.log(animals[0]);
animals.length = 2;
console.log(animals[3]);
46
//(hint:https://0.30000000000000004.com/ ) :
βοΈconsole.log(0.1 + 0.2);
47
Write a fxn to reverse a string
48
const codeShop = {
company: "Code Factory",
address: "Square building, 10000 Moon St"
}
let π§= Object.create(codeShop);
deleteπ§.codeShop;
console.log(π§.company);//βοΈ
//β€οΈhint: hasOwnProperty
49
//βοΈ Duplicate the elements of an arrayβοΈ
function duplicateArr(myArr) {
return(β);
}
duplicateArr(["a", "b", "c"]); //["a", "b", "c", "a", "b", "c"]
50
//Complete the following fxn:
function funFxn() {
let secret = "this is a secret";
βββββ
}
let getSecret = funFxn(); // "this is a secret"
51
//πConvert this to an anonymous fxn in #javascript
function love(param){
console.log(`I love ${param}`);
}
love("dogs");
52
Define:
- Event Loop
- Callback fxn
- Stack
- Task queue
- Higher Order Fxn
- Var, Const, Let
- Lexical Scope
- Closure
- Anonymous Fxn
- Event bubbling
53
let arr = [π, π, π, π];
arr.ββ(π₯, 1, 3);
console.log(arr)//[π, π₯, π₯,π];
54
White space is retained in ES6 template literals? T/F
55
<h2 id="para1"></h2>
localStorage.β("guestName", "missLorem");
document.getElementById("para1").innerHTML = localStorage.β("guestName");
Top comments (0)