JavaScript определяет функцию
function nameFunction(parameters) {
document.write("function script")
}
Rick Astley
function nameFunction(parameters) {
document.write("function script")
}
function myFunction(var1, var2) {
return var1 * var2;
}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>Holy guacamole!</strong> You should check in on some of those fields below.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
function name( parameter1 ,parameter 2,..) //name signifies funcname
{
}
var x = myFunction(10, 10); // 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
}
$('a.button').click(function(){
if (condition == 'true'){
function1(someVariable, function() {
function2(someOtherVariable);
});
}
else {
doThis(someVariable);
}
});
function function1(param, callback) {
...do stuff
callback();
}