Skip to content

Latest commit

 

History

History
49 lines (44 loc) · 1.22 KB

File metadata and controls

49 lines (44 loc) · 1.22 KB

expression:

An expression evaluates into (results in) a single value.

type of expression:

  • EXPRESSIONS THAT JUST ASSIGN A VALUE TO A VARIABLE
  • EXPRESSIONS THAT USE TWO OR MORE VALUES TO RETURN A SINGLE VALUE

example:

  • var color = 'beige'.
  • var area = 3 * 2 .

operator:

Expressions rely on things called operators; they allow programmers to

create a single value from one or more values

  • ASSIGNMENT OPERATORS.

example:

  • color = 'beige'.

ARITHMETIC OPERATORS:

example:

  • area = 3 * 2 .

WHAT IS A FUNCTION?

Functions let you group a series of statements together to perform a speceific task .

declaring function ?

  • function sayhello(){ document.write("hello");

}

calling function?

you can excute all of the statement between curly braces with just one line of the code .

sayhello();

declaring function that need information .

give it parameter inside the function.

function getarea( width,height){

return width*height; }

calling :

getarea(width,height);

getting asingle value out of afunction

some function return the information to the code that called them .

function getarea( width,height)

{ var area= width* height; return area;

}

var one= getarea(3,5);