Question: Javascript assistance: The Skier Object Currently, the output in the HTML reads, Person is a downhill slider of unknown skill on the slopes. You are
Javascript assistance: The Skier Object
Currently, the output in the HTML reads, "Person is a downhill slider of unknown skill on the slopes." You are going to create an object whose properties will reconstruct the sentence to read something like, "John Smith is a snowboarder of advanced skill on the slopes."
Using an object constructor function (the third type discussed in the lecture), create a new Skier object with the following properties: first name, last name, type (skier, snowboarder, etc), and ability (beginner, intermediate, advanced, etc).
Create a method on the prototype on the Skier object that combines the first and last names into a full name.
Create an instance of the Skier object
Uncomment the 'textContent' lines of code and replace the empty strings with the correct code that will display your new sentence in the DOM.
Submit the URL of your Pen as the assignment.
Third lecture example:
function Person (name, age, employed, profession){ this.name = name; this.age = age; this.employed = employed; this.profession = profession } var plumber = new Person('Bill Jones', 25, true, 'plumber'); var banker = new Person('Jane Jones', 23, true, 'banker');
Code I already have,
HTML
Person is a downhill slider of unknown skill on the slopes.
CSS
body { background-color: #b0d0ff; }
img { text-align: center; }
.container { background-color: #FFF; width: 50%; height: 500px; margin: 0 auto; padding: 0 20px; border-radius: 20px; }
JS
(function(){ const fullname = document.getElementById('fullname'); const type = document.getElementById('type'); const ability = document.getElementById('ability');
// create your Skier object here.
// Then, un-comment the lies below and replace the empty strings with the correct code to display your person's name, type and ability in the HTML output window.
//fullname.textContent = 'Joe'; //type.textContent = ''; //ability.textContent = '';
}())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
