You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// It will give you a percentage of 50% using the function by multiplying the 'decimalNumber' by 100 for the 'percentage' variables.
2
3
3
4
// Why will an error occur when this program runs?
4
-
// =============> write your prediction here
5
+
// It will be a syntaxError because the 'decimalNumber' is already called in the function parameter.
5
6
6
7
// Try playing computer with the example to work out what is going on
7
8
9
+
// function convertToPercentage(decimalNumber) {
10
+
// const decimalNumber = 0.5;
11
+
// const percentage = `${decimalNumber * 100}%`;
12
+
13
+
// return percentage;
14
+
// }
15
+
16
+
// console.log(decimalNumber);
17
+
18
+
// decimalNumber in console.log isn't a defined number in the functions parameter now so it will return back as NaN "Not a Number", by adding '0.05' to the console.log it now has a number to calculate the percentage to
0 commit comments