menjalankan fungsi dalam fungsi javascript
function runFunction() {
myFunction();
}
function myFunction() {
alert("runFunction made me run");
}
runFunction();
Lava
function runFunction() {
myFunction();
}
function myFunction() {
alert("runFunction made me run");
}
runFunction();
function abc() {
alert('test');
}
var funcName = 'abc';
window[funcName]();
// we create a function by typing the keyword " function" + Function's name and ( we add the parameter here )
// {
// the function body
// }
// we call the function by typing it's name without the keyword and we add ()
function second (name){
name = "Elmustafa";
alert(name);
}
first();
// calling our function
displayGreeting();
(function(){ // some private code that will be executed automatically})
const person = {
firstName:"John",
lastName: "Doe",
fullName: function () {
return this.firstName + " " + this.lastName;
}
}
// This will return "John Doe":
person.fullName();