Question: Please modify the following javascript so that instead of displaying in the console, it displays on a webpage. // Assign person's age to myAge variable

Please modify the following javascript so that instead of displaying in the console, it displays on a webpage.

// Assign person's age to myAge variable

let myAge = 30;

// Assign value 2 to earlyYears variable

let earlyYears = 2;

// Multiply earlyYears by 10.5 and reassign it to earlyYears

earlyYears *= 10.5;

// Calculate laterYears by subtracting 2 from myAge

let laterYears = myAge - 2;

// Multiply laterYears by 4

laterYears *= 4;

// Add earlyYears and laterYears and assign it to myAgeInDogYears

let myAgeInDogYears = earlyYears + laterYears;

// Assign person's name to myName variable and convert it to lowercase

let myName = 'John'.toLowerCase();

// Output the result

console.log(`My name is ${myName}. I am ${myAgeInDogYears} years old in dog years`);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!