A function is a self-contained block of code that performs a specific task and can be reused multiple times by calling it.
Syntax :
function functionName(parameters) {
// code to be executed
}
Variables :
A variable stores data that can be used and manipulated in a program.
Global Variable :
A global variable is declared outside any function or block, and it is accessible anywhere in your code, including inside functions.
Local Variable :
A local variable is declared inside a function or block, and it is accessible only within that function or block.
Event :
An event is an action or occurrence that happens in the browser, which your JavaScript code can detect and respond to.
Events allow your website to be interactive and dynamic. Without events, a web page is just static content.
Event = Action that happens in the browser (like clicking or typing)
Used to = Make web pages interactive
Top comments (0)