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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started