[Go to site: main page, start]

0% found this document useful (0 votes)
5 views2 pages

JavaScript Intro Notes

JavaScript is a high-level, interpreted programming language created by Brendan Eich in 1995, used for adding interactivity to webpages and running on both browsers and servers via Node.js. It features variable declarations with var, let, and const, each with different scopes and reassignment rules, and supports reusable functions, including declarations, expressions, and arrow functions. Modern JavaScript (ES6+) enhances the language with features like arrow functions and async/await, improving code readability and organization.

Uploaded by

astastaia15
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

JavaScript Intro Notes

JavaScript is a high-level, interpreted programming language created by Brendan Eich in 1995, used for adding interactivity to webpages and running on both browsers and servers via Node.js. It features variable declarations with var, let, and const, each with different scopes and reassignment rules, and supports reusable functions, including declarations, expressions, and arrow functions. Modern JavaScript (ES6+) enhances the language with features like arrow functions and async/await, improving code readability and organization.

Uploaded by

astastaia15
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Intro Notes

What is JavaScript?
JavaScript is a high-level, interpreted programming language that adds interactivity and
dynamic behaviour to webpages. Originally created by Brendan Eich in 1995, it has grown
into one of the most widely-used languages in the world, powering both front-end browser
experiences and back-end server applications through [Link].

JavaScript runs directly in the browser without any compilation step, which makes it ideal for
real-time user interactions such as form validation, animations, API calls, and DOM
manipulation. Modern JavaScript (ES6+) introduced arrow functions, classes, modules, and
async/await, making the language more powerful and easier to read.

Topic Description

What is JS? Adds interactivity to webpages

Where it runs Browser and server ([Link])

Creator Brendan Eich, 1995

Current standard ECMAScript 2023 (ES14)

Variables
Variables are containers that store data values. JavaScript provides three keywords for
declaring variables: var, let, and const. The var keyword has function scope and allows
re-declaration, making it prone to bugs. The let keyword, introduced in ES6, has block scope
and cannot be re-declared in the same scope. The const keyword also has block scope but
additionally prevents reassignment, making it perfect for values that should not change.

Choosing the right declaration keyword improves code clarity. Always prefer const by default;
switch to let when you know the value will change; avoid var in modern code. Examples: const
PI = 3.14; let counter = 0; var legacyVar = 'old';

Keyword Scope

var Function scope, can re-declare

let Block scope, cannot re-declare

const Block scope, no reassignment


Functions
Functions are reusable blocks of code that perform a specific task. They help keep code
organized, readable, and DRY (Don't Repeat Yourself). A function is defined once and can be
called multiple times with different arguments. JavaScript supports function declarations,
function expressions, and arrow functions (ES6+).

Arrow functions provide a shorter syntax and do not bind their own 'this', making them
especially useful in callbacks and array methods. Example: const add = (a, b) => a + b;
Regular functions are best when you need 'this' context, such as inside object methods or
constructors.

Type Syntax

Declaration function name() {}

Expression const f = function() {}

Arrow const f = () => {}

You might also like