Who Is Talking?
JavaScript
10 pts
Who Is Talking?
Write one function introduce() that returns My name is … and I live in …. using this.name and this.city.
Create two objects, selam (Selam, Asmara) and yonas (Yonas, Keren). Give both the same function as a method called introduce (shorthand: { name: …, city: …, introduce }). Print both introductions. Expected output:
My name is Selam and I live in Asmara. My name is Yonas and I live in Keren.
Checklist
- Write
introduce()withthis. - Create
selamandyonasthat share the function. - Print both introductions.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
