Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what is the difference between console.log and return

/* this is a function that return the square of the argument */
var square = function(x) {
  return x * x;
}
/* we want to log in the console the value of x+(x*x)
var x = 7;
console.log(x + square(x));
/* should log 7+(7*7) => 7+49 => 56 in the console
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #difference #return
ADD COMMENT
Topic
Name
5+8 =