Create four values and inspect each with the right Number method or property: people = 8100000000 (the world population). Print “People safe:” and whether it is a safe integer. ants = 20000000000000000. Print “Ants safe:” and whether it is a …
Explore the limits of numbers: Print Number.MAX_SAFE_INTEGER. Create next = Number.MAX_SAFE_INTEGER + 1 and print Number.isSafeInteger(next). Create huge = Number.MAX_VALUE * 10 and print it. Print Number.isFinite(huge). Expected output: 9007199254740991 false Infinity false
Abel’s marks came from a form as text (see the starter). Create average: convert the three marks to numbers (Number or parseFloat), add them and divide by 3. Print “Average:” with one decimal (toFixed(1)). Create rounded: the average rounded to …
Use the starter values. A customer buys qty items at price each and pays with the text input. Create total = price * qty and print “Total:” with total.toFixed(2). Create paid as a number read from input (use parseInt or …
Create these variables and print each one (or its type) on its own line: sum = 0.1 + 0.2 fixed = the same sum calculated with whole numbers: (0.1 * 10 + 0.2 * 10) / 10 big = 1500 …
Use the variables from the starter. Create cost = kg * pricePerKg and print “Cost:” and cost. bags is text. Create bagCost = bags * bagPrice and print “Bags:” and bagCost. Create joined = bags + bagPrice to see the …
Create one template literal called receipt that spans five lines, and print it with a single console.log. Use the variables from the starter in ${ } holes and calculate the prices inside the holes. Asmara Café Customer: Senait 3 x …
The starter has team, goals, opponent and against. Print two lines using template literals only (no + joining): The score line: team, goals, a dash, against, opponent. The goal difference, calculated inside ${ } as goals – against. Expected output: …
The starter has let player = “yonas tekle”;, let number = “7”; and let city = “Mendefera”;. Create code: the first 3 letters of city in upper case, a dash, and number padded with zeros to 3 characters. Print it. …
The starter has let input = ” SeLaM_Asmara “; — a username typed carelessly. Create clean: input trimmed and in lower case (use trim() and toLowerCase()). Print it. Print the length of clean. Print whether clean includes “asmara”. Print the …
