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)