Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

EECS 468 Fall 2023 ICP6, Assignments of Computer Science

EECS 468 Fall 2023 ICP6 programming paradigms

Typology: Assignments

2022/2023

Uploaded on 04/04/2024

mikaela-navarro
mikaela-navarro 🇺🇸

3 documents

Partial preview of the text

Download EECS 468 Fall 2023 ICP6 and more Assignments Computer Science in PDF only on Docsity! <!--declaration for the html file to shop up on browser--> <!DOCTYPE html> <html> <body> <!--header tag – makes text big--> <h2>JavaScript Arrays</h2> <!--paragraph tag under the header – text will be smaller--> <p>Compute the sum of the rounded numbers in an array.</p> <!--when styling or doing css can reference to this specific paragraph below using the id=”demo”--> <p id="demo"></p> <!--script tag – make your html file interactive with functions -array of numbers to be used in the function below -will send and show the output from the getSum function to the p tag with the id="demo" -calls the function to add the numbers in the array and round it to the nearest number --> <script> const numbers = [15.5, 2.3, 1.1, 4.7]; document.getElementById("demo").innerHTML = numbers.reduce(getSum, 0); function getSum(total, num) { return total + Math.round(num); } </script> </body> </html> JavaScript Arrays Compute the sum of the rounded numbers in an array. 24
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved