Javascript Quiz: How well do you know concatenation in JS

Опубликовано: 02 Октябрь 2024
на канале: Programming Geek
66
4

Are you ready for another code challenge? Join me in this video as you test your coding knowledge with the simple quiz questions.

Don't forget to make your guess in the comments below.

-------------------------------------------------------------------------------------------

🔔Like and subscribe for more videos. 🔔

Connect me on linkedin :
https://www.linkedin.com/in/meenakshilodhi...
https://www.linkedin.com/in/rk-barnwal23/
------------------------------------------------------------------------------------------

Answer OPTION: A) "John Doe"

Explanation:
The code defines an object person with properties firstName and lastName.

The fullName property is assigned a function that returns the concatenation of firstName and lastName.

When person.fullName() is called, it invokes the fullName function in the context of the person object.

Inside the fullName function, this refers to the person object, so this.firstName retrieves the value "John" and this.lastName retrieves the value "Doe".

The concatenation of "John" and "Doe" results in "John Doe".

Hence, the output will be "John Doe".