Question: Write a JavaScript program to perform the following tasks: Declare a variable named aStr and assign a value of '-5' to this variable Declare a
Write a JavaScript program to perform the following tasks:
- Declare a variable named aStr and assign a value of '-5' to this variable
- Declare a variable named aNumber
- Conver the aStr from the string to the number data type (base 10) and assign this value to the aNumber variable. Use a Number function (e.g. Number(aStr))
- Declare another variable named posNum and assign the absolute value of the aNumber variable to this variable. Use abs function (e.g. Math.abs(posNum))
- Print out the value of the posNum to the console. Using the console.log function
(this is only my first assignment so i still dont understand a lot of what is going on. i would like to understand each step taken if possible, thanks!)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
