2. js - introduction functions


#1

Please, I have difficulties with my syntax.

thx

// This is what a function looks like:

var divideByThree = function (300) {
var val = 300 / 3;
console.log("30");
};

// On line 12, we call the function by name
// Here, it is called 'dividebythree'
// We tell the computer what the number input is (i.e. 6)
// The computer then runs the code inside the function!
divideByThree(12);


#2

function is suppose to have the variable 'number' not an actual number which is why you need to replace 300 to 'number'

console.log("30") is wrong, suppose to be
console.log(val)


#3

thx,
it's working now.
great


#4

A post was split to a new topic: Introduction to functions


#5