Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Enregistrer le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <body> <h2>Fonctions JavaScript</h2> <p>This example calls the fullName method of person, using it on person1: </p> <p id="demo"></p> <script> const person = { fullName: function(ville, pays) { return this.firstName + " " + this.lastName + "," + city + "," + country; } } const person1 = { firstName:"John", lastName: "Doe" } const person2 = { firstName:"Marie", lastName: "Doe" } document.getElementById("demo").innerHTML = person.fullName.call(person1, "Oslo", "Norvège"); </script> </body> </html>