In javaScript
//In the first section calculates the average of the numbers//
//FIRST SECTION//
//The second section has a function to calculate the average//
//Fix all issues//
a = (1,2,3,4,5,6,7,8,9,10);
b = 6;
c = 7.5;
test;
var i = 1;
c = 0;
for (i = 0; i <a.length; i++){
console.log (' i = ' + i + ' ai = ' + a[i]);
c = c + a[i];
console.log ( 'c = ' + c);
};
console.log(c);
console.log(i);
average = c/i;
console.log(average);
//++++++++++++++++++++++++++++++++++++++++++++++++
//SECTION TWO//
function test(){
console.log ('test function');
for (i = 0; i <10; i++){
console.log (' i = ' + i + ' ai = ' + a[i]);
c = c + a[i];
console.log ( 'c = ' + c);
};
console.log(c);
console.log(i);
average = c/i;
console.log(average);
}
<html>
<body>
HIII
<script>
var a = [1,2,3,4,5,6,7,8,9,10];
var average;
var c = 0;
for (i in a){
console.log(" i = " + i + " ai = "+ a[i]);
c = c + a[i];
console.log ( 'c = ' + c);
}
n=a.length;
console.log(c);
console.log(n);
average = c/n;
console.log(average);
</script>
</body>

second program:Using function
<html>
<body>
HIII
<script>
var a = [1,2,3,4,5,6,7,8,9,10];
var average;
var c = 0;
avg(a);
function avg(a)
{
for (i in a){
console.log(" i = " + i + " ai = "+
a[i]);
c = c + a[i];
console.log ( 'c = ' +
c);
}
n=a.length;
console.log(c);
console.log(n);
average = c/n;
console.log(average);
}
</script>
</body>

In javaScript //In the first section calculates the average of the numbers// //FIRST SECTION// //The second...
How to find sum of the first and last 3 numbers? #Javascript
Function P2<yourname>. When button "problem 2" is clicked, a JavaScript function equivalent to the following flowchart should execute. In other words, your task here is to translate the following flowchart to JavaScript code in P2<yourname>: start sum1 0 sum2 0 P i0 i< 3 iei+1 num sum1 sum1 + num F i <3 ii+1 sum1 sum2 "no" num "yes" sum2 sum2 + num end Hint: for input, use...
JavaScript Just use javascript, dont include HTML Follow the instructions bellow for a good rate Create a program that will display the result of three functions: a) sum the elements from the Fibonacci sequence b) divide them by randomly generated number c) calculate factorial from the rounded result of previous operation Functions should be stored in one, separate file. The main program should run from the app.js that is provided bellow, the other file should be called module.js that includes...
I have this module of javascript var data = [ {id: 1, firstName: 'John', lastName: 'Smith'}, {id: 2, firstName: 'Jane', lastName: 'Smith'}, {id: 3, firstName: 'John', lastName: 'Doe'} ]; module.exports.setid = function (value) { data.id = value; }; module.exports.getid = function () { return data.id; }; module.exports.setFirstName = function (value) { data.firstName = value; }; module.exports.getFirstName = function () { return data.firstName; }; module.exports.setLastName = function (value) { data.lastName = value; }; I wrote the following to get all first...
Write a program that calculates the average of a stream of non-negative numbers. The user can enter as many non-negative numbers as they want, and they will indicate that they are finished by entering a negative number. For this program, zero counts as a number that goes into the average. Of course, the negative number should not be part of the average (and, for this program, the average of 0 numbers is 0). You must use a method to read...
Create a function in JavaScript called "sum" that takes in an array as a parameter and returns the sum of all of the EVEN numbers in a given array. Please note: the array passed in can have any data type, i.e. Strings, Numbers, Booleans, undefined, etc. HINT: the expression typeof will help discern var types. For example if I have: var x = 4, and I do typeof(x) - the output would be "Number" Example run: sum([1, 4, 8, 10,...
you will write two versions of a function that calculates the sum of all the numbers in a LinkedList. In the first version, you should use an iterator and either a while loop or a traditional for loop to compute the sum . In the second version, you should use the range - based for loop. Write one or more tests in a main() function that demonstrate that either version of your function works as intended. I would personally like...
Add comments to it by filling in the blank comments numbers 1 through 32. (The first few comments are HTML comments, not JavaScript comments, and are bracketed according to <!- this is an HTML comment>.) <!DOCTYPE html> <html> <body onload="handleFormAction()"> <h2>Form handling example in JavaScript</h2> <h3>(Or, John Doe meets Robbie Robot)</h3> <h4>Instructions: Fill in the form. Then fill in comments 1 through 23 in the JavaScript code!</h4> <form target="_blank" action= > <!- 1: replace this placeholder HTML comment with a...
Write a C program that numerically calculates the second derivative of the function f(t) = sin(H) + 0.3A where the input&ranges [0:0.1:5). Find the second derivative at each point not including the first and last points. Also calculate the analytical solution at each point. Print to the screen the numerical and analytical results for comparison
HTML , Javascript Canvas problem:
could you pleaseeee help me to do these things-
suppose, user draw a picture, then that picture(lines on Canvas)
will be saved as commands, so when the user will refresh the
webpage or when I will execute the code, then when I will press the
"load" button, the last picture which I made will come on the
canvas from localStorage.
<!DOCTYPE html>
<html>
<head>
<script>
var commands = [];
var start = 0;
var c;...