💾 Archived View for gem.sdf.org › s.kaplan › cheatsheets › programming-languages › javascript.md captured on 2024-08-31 at 12:51:08.

View Raw

More Information

⬅️ Previous capture (2023-09-28)

-=-=-=-=-=-=-

# JavaScript Cheatsheet

JavaScript is a high-level programming language used primarily for developing web applications. Here is an overview of its features, code blocks, and resources.

## Features

- JavaScript is a scripting language that can be used to add interactivity to web pages.
- It can be used for both front-end and back-end development.
- JavaScript is dynamically typed, which means that variables do not need to be declared before use.
- JavaScript supports functional programming paradigms as well as object-oriented programming.

## Code Blocks

### Variables

Variables are used to store data that can be used later in the program.

let variableName = value;


### Functions

Functions are code blocks that perform a specific task. They can be called by other parts of the program.

function functionName(parameter1, parameter2) {

// code to be executed

}


### Conditionals

Conditionals allow the program to make decisions based on certain conditions.

if (condition) {

// code to be executed if condition is true

} else if (otherCondition) {

// code to be executed if otherCondition is true

} else {

// code to be executed if neither condition is true

}


### Loops

Loops allow the program to repeat a set of instructions.

for (let i = 0; i < 10; i++) {

// code to be executed

}


### Objects

Objects are a fundamental part of JavaScript and are used to store and manipulate data.

const objectName = {

property1: value1,

property2: value2,

method: function() {

// code to be executed

}

};


## Resources

Here are some resources for learning and using JavaScript:

- [JavaScript Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
- [JavaScript subreddit](https://www.reddit.com/r/javascript/)
- [W3Schools JavaScript Tutorial](https://www.w3schools.com/js/)
- [JavaScript on Stack Overflow](https://stackoverflow.com/questions/tagged/javascript)