Last active
August 29, 2015 14:02
-
-
Save mannuelf/c320eddf1453815859ea to your computer and use it in GitHub Desktop.
Define a Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function constructor : the last paramater is the function logic, everything before it is a paramater | |
var theConstructor = new Function('x', 'y', 'return x + y'); | |
// function statement | |
function theStatement(x, y) { | |
return x + y | |
}; | |
// function expression | |
var theExpression = function(x, y) { | |
return x + y; | |
}; | |
console.log(theConstructor(2,2), theStatement(2,2), theExpression(3,3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment