Functions in Java Script
Functions are blocks of code that can be called to perform a specific task. They can be declared using the function keyword.
Here's an example of a function that takes two parameters and returns their sum:
javascript
function addNumbers(num1, num2) {
return num1 + num2;
}
To call this function, you would use the function name followed by the arguments in parentheses:
scss
var sum = addNumbers(3, 4);
No comments:
Post a Comment