Respuesta :

Answer:

hope it helps

Explanation:

function start(){

   triangleArea(5,4);

}

function triangleArea(BASE, HEIGHT){

   var result=1/2 * BASE * HEIGHT

   println(result);

}

Following are the correct Javascript program to calculate the area of the triangle:

Program to calculate the area of the triangle:

function start()//defining the method start

{

  triangleArea(5,4);//calling the method triangleArea that takes two integer values inside the parameter

}

function triangleArea(BASE, HEIGHT)//defining a method triangleArea that takes two integer variables inside the parameters

{

  var result=1/2 * BASE * HEIGHT//defining a variable result that calculates the area of a triangle by using a formula and storing its value

  print(result);//using print method that prints result in variable value

}

start();//calling the method start

Output:

please find the attached file.

Program Explanation:

  • Defining the method start.
  • Inside the method, "triangleArea" method is called that takes two integer values that are "5,4" inside the parameter.
  • Outside this method, "triangleArea" method is defined that takes two variables "BASE, HEIGHT" inside the parameter.
  • Inside this method, the result variable is declared that use the area of triangle formula to calculate and store its value and use print method to print its value.
  • Outside the method, a start method is called that starts the working of the methods.

Errors in the given code:

On the 5 lines, there is an error, and the start method is not called that's why it's not run.

Find out more about JavaScript here:

brainly.com/question/16698901

Ver imagen codiepienagoya