simple javascript function
function idk() {
alert('This is an alert!')
}
//call the function to make the function run by saying "Name of function + ()"
idk()
simple javascript function
function idk() {
alert('This is an alert!')
}
//call the function to make the function run by saying "Name of function + ()"
idk()
function javascript
var x = myFunction(4, 3); // Function is called, return value will end up in x
function myFunction(a, b) {
return a * b; // Function returns the product of a and b
}
javascript function
function myFunc(theObject) {
theObject.make = 'Toyota';
}
var mycar = {make: 'Honda', model: 'Accord', year: 1998};
var x, y;
x = mycar.make; // x gets the value "Honda"
myFunc(mycar);
y = mycar.make; // y gets the value "Toyota"
// (the make property was changed by the function)
functions in javascript
function name( parameter1 ,parameter 2,..) //name signifies funcname
{
}
function javascript
A JavaScript function is defined with the function keyword,
followed by a name, followed by parentheses ().
Function names can contain letters, digits, underscores,
and dollar signs (same rules as variables).
The parentheses may include parameter names separated by commas:
(parameter1, parameter2, ...)
The code to be executed, by the function, is placed inside curly brackets: {}
_____________________________________________________
function name(parameter1, parameter2, parameter3) {
// code to be executed
}
____________________________________________________
let x = myFunction(4, 3); // Function is called, return value will end up in x
function myFunction(a, b) {
return a * b; // Function returns the product of a and b
}
Function Javascript
function myFunction() {
alert("Hello World!");
}
myFunction;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us