This means that when we call perimeter, it doesn't refer to the shape object, but to its surrounding scope (window for example).
Since there is no value radius in the scope of the arrow function, this.radius returns undefined which, when multiplied by 2 * Math.PI, results in NaN
Day 3 of Learning Javascript from Interview Questions
What's the output?
A: 20 and 62.83185307179586
B: 20 and NaN
C: 20 and 63
D: NaN and 63
#javascript#reactjs#webdevelopment#nextjs
Answer: B
Note that the value of diameter is a regular function, whereas the value of perimeter is an arrow function.
With arrow functions, the this keyword refers to its current surrounding scope, unlike regular functions!
continue...
Answer: A
The unary plus tries to convert an operand to a number. true is 1, and false is 0.
The string 'Lydia' is a truthy value. What we're actually asking, is "Is this truthy value falsy?". This returns false.
Day 3 of Learning Javascript from Interview Questions
What's the output?
A: 1 and false
B: false and NaN
C: false and false
#javascript#webdevelopment#reactjs#nextjs
Answer: A
In JavaScript, all objects interact by reference when setting them equal to each other.
First, variable c holds a value to an object. Later, we assign d with the same reference that c has to the object.
When you change one object, you change all of them.
Day 5 of Learning Javascript from Interview Questions
What is the output?
B: Hey!
C: undefined
D: ReferenceError
E: TypeError
#reactjs#javascript#nextjs#webdevelopment
spending 2 years as reactjs/nextjs developer, suddenly client offers a plane html, css, javascript project, at first I was excited to do it but as I went deep down in project I am regretting my decision
#javascript
Day 1 of Learning Javascript through MCQs
1. What's the output?
A: Lydia and undefined
B: Lydia and ReferenceError
C: ReferenceError and 21
D: undefined and ReferenceError
#javascript#webdevelopment#reactjs#Nextjs
Programming is such a challenging joyride!
โ Frequent encounters with soul-crushing setbacks are why most who want to break into tech get discouraged at the first one & leave.
โ If you can't bounce back after the first fall, this career isn't for you.
....The exit condition for the loop is to set the variable a as fasle. But as the loop continously running on the main thread , it a cannot be set false.
#javascript
Answer:
The above program will print Hello infinitely. Since, Javascript is a single threaded language the actual execution happens only on the main thread....
JavaScript is all about the execution context! This big box holds all the variables and functions, and it's where the code runs one line at a time. #javascript#programming#js