JS Mini Challenges Week 1

Search for a command to run...

No comments yet. Be the first to comment.
Yarn Commandnpm EquivalentDescription yarn initnpm initInitializes a new project yarn installnpm installInstalls dependencies based on the package.json file yarn add <package>npm install <package>Adds a package as a project dependency yarn remo...

https://marketplace.visualstudio.com/items?itemName=sravanth.fullstack-essentials I have created an extension pack that contains all the extensions I use. Installing this one extension pack allows you to install all the extensions which are under it....

Introduction: In the world of web development, optimizing performance is crucial for delivering exceptional user experiences. One of the key strategies to achieve this is through the implementation of lazy loading and code splitting techniques. In th...

Center a div <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <sty...

If we are dealing with top/maximum/minimum/closest 'K' elements among 'N' elements, we will be using a Heap. If the given input is a sorted array or a list, we will either be using Binary Search or the Two Pointers strategy. If we need to try all c...

var foo = function(){
var args = Array.prototype.slice.call(arguments);
console.log(args[1])
}
foo(1,2,4) //?
const obj1 = {
a: 5,
b: {
c: 6
}
}
const obj2 = Object.assign({}, obj1)
const obj3 = { ...obj1 }
obj1.b.c = 8
console.log(obj2) //?
console.log(obj3) //?
console.log(Object.assign({}, obj1, obj2, obj3)) //?
console.log(null == undefined) //?
console.log(null === undefined) //?
var power = "100"
function getPowerNumber() {
var power = "10"
function f() {
return power
}
return f
}
console.log(getPowerNumber()()) //?
var obj = { hasOwnProperty: 1, foo: 2 }
console.log(obj.hasOwnProperty('foo')) //?
function person(id, name) {
var id = id
var name = name
}
function student(id, name) {
person.call(this, id, name)
}
console.log(new student(50, "Sravanth").id);//?
console.log(Boolean("false") === Boolean(false)); //?
let foo = (a = 3, b = 5) => {
console.log(a + b);
}
foo(7, 4) //?
function foo() {
console.log(a); //?
var a = 4;
console.log(a); //?
}
foo()
function foo() {
console.log(a); //?
let a = 4;
console.log(a); //?
}
foo()
const first = 6 * "JS";
const second = 6 * "JS";
console.log(first !== second )//?
// Answer:
//In the lines number 9 and 10, a number is multiplied by a string which will return
//NaN. Since NaN(not a number) is not equal to anything, not even itself; //true will be
//logged to the console.