Hard
What are the call and apply keywords used for?
Author: Jean-marie CléryStatus: PublishedQuestion passed 2322 times
Edit
1
Community Evaluations
hugo
01/03/2023
Apply ne prend pas forcément un second argument en paramÚtre.
const user = {
name: "Pedro",
sayHi(){
return `hi my name is ${this.name}`
}
}
const otherUser = {
name: "Bob"
}
console.log(user.sayHi.apply(otherUser)) // 1 seul paramĂštre et c'est pas un tableau.
hugo
01/03/2023
AprĂšs c'est pas marquĂ© sur la documentation que ca fonction sans tableau avec un seul argument. Donc mon objet "otherUser" est-il un tableau ? Peut-ĂȘtre. Mais il n'empĂȘche que ça marche quand mĂȘme trĂšs bien avec un seul argument.
6
What will this code display?7
Invert a string in Javascript8
Which of the following equality(s) are true? 0 == '', 'f' + 1 == 'f1'7
Which of the following is the **most optimized** method for creating a literal object?5
What will be the first thing that the following code displays?9
Write a Javascript code that prints the indexes of an array.5
How to call a function inside a function in Javascript