coding ans
coding ans
function changevalue(p)
p = 5;
let a=10;
let b=5;
changevalue(b);
console.log(result)
ANSWER: 10 -5
B. -- [ false, { } ]--
ANSWER : C
B. setInterval(sayHello, 12000);
C. setTimeout(sayHello(), 12000);
D. delay(sayHello, 12000);
25.flag();
anotherflag();
function flag(){
console.log('flag');
}
const anotherflag = () =>{
console.log('another flag');
}
What is result of the code block?
A. The console logs only 'flag'.
B. An error is thrown.
B. Console16bit.prototype.load = function(gamename) {
C. Console16bit.prototype.load(gamename) = function() {
Answer: option b
ANSWER: Return (Number(num+10)/3 options order are differemt from out pdf
--------------------------------------------------------
7.
Let productSKU = '8675309' ;
A developer has a requirement to generate SKU numbers that are always 19 characters
lon, starting with 'sku', and padded with zeros.
Which statement assigns the values sku0000000008675309 ?
-----------------------------------------------------
let x= null;
console.log(typeof x)
output object
Answer : Object
----------------------------------------------------
9. At Universal Containers, every team has its own way of copying JavaScript
objects. The code
Snippet shows an implementation from one team:
function Person() {
this.firstName = "John";
this.lastName = 'Doe';
this.name =() => (
console.log('Hello $(this.firstName) $(this.firstName)')
)}
const john = new Person ();
const dan = JSON.parse(JSON.stringify(john));
dan.firstName ='Dan';
dan.name();
What is the Output of the code
execution?
--------------------------------------------------
Output : [ 1, 2, 3, 4, 5, 4 ]
Answer : D
---------------------------------------------------------
A. Sum (5, 5) ()
B. sum() (5, 5)
C. sum(10) ()
D. sum(5)(5)
E. Sum () (20)
------------------------------------------------------------
37.let o = {
get js() {
let city1 = String("st. Louis");
let city2 = String(" New York");
return {
firstCity: city1.toLowerCase(),
secondCity: city2.toLowerCase(),
}
}
}
What value can a developer expect when referencing o.js.secondCity?
console.log(o.js.secondCity)
Output : new york
--------------------------------------------------------------------
43. what will be the output of the below when called with an empty array?
A. Returns 0
B. Throws an error
C. Returns 10
D. Returns NaN
const myFunction = arr => {
return arr.reduce((result, current) =>{
return result = current;
}, 10); }
console.log(myFunction([]));
Output: 10
ANSWER: C.Returns 10
------------------------------------------------------------------------
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
=====>>B,C,D
----------------------------------------------------------------------
51.Refer to code below:
Const objBook = {
Title: �Javascript�,
Object.preventExtensions(objBook); Const
newObjBook = objBook;
newObjectBook.author = �Robert�;
A. [title: �javaScript�]
title: �javaScript�]
B. {author: �Robert�, title: �javaScript} Undefined
C. {author: �Robert�, title: �javaScript}
{author: �Robert�, title: �javaScript}
D. {author: �Robert�} {author: �Robert�,
title: �javaScript}
Answer:
======
const objBook = {
title: �Javascript�,
};
Object.preventExtensions(objBook);
const newObjBook = objBook;
newObjBook.author = 'Robert';
console.log(objBook);
console.log(newObjBook)
Output:
{ title: 'Javascript' }
{ title: 'Javascript' }
------------------------------------------------------------------------
ANSWER:
function func2(){
console.log(0);
console.log(2)
setTimeout(() => console.log(3), 0);
console.log(4)
}
func2()
OUTPUT:
0
2
4
1
3
ANSWER: C)02413
------------------------------------------------