Skip to content

fadumasaidcodes/array-calculator

Repository files navigation

Array-calculator

simple array calculator website using only HTML, CSS, and JavaScript:

1. Create a function called "calculate"

2. Inside the function, get the value of the input field with the id "array" and assign it to the variable "array"

3. Split the "array" variable into individual elements and assign the resulting array to "array"

4. Create a for loop that iterates over each element in "array" and converts it to a number

5. Set the variable "sum" to 0

6. Create a for loop that iterates over each element in "array" and adds it to the "sum" variable
7. Divide the "sum" variable by the length of "array" and assign the result to the variable "average"
8. Set the innerHTML of the element with the id "result" to the string "Sum: " concatenated with the "sum" variable, a line break, and the string "Average: " concatenated with the "average" variable.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published