|
|
--- |
|
|
title: JavaScript Guide |
|
|
slug: Web/JavaScript/Guide |
|
|
page-type: guide |
|
|
sidebar: jssidebar |
|
|
--- |
|
|
|
|
|
The JavaScript Guide shows you how to use [JavaScript](/en-US/docs/Web/JavaScript) and gives an overview of the language. If you need exhaustive information about a language feature, have a look at the [JavaScript reference](/en-US/docs/Web/JavaScript/Reference). |
|
|
|
|
|
This Guide is divided into the following chapters. |
|
|
|
|
|
## Introduction |
|
|
|
|
|
Overview: [Introduction](/en-US/docs/Web/JavaScript/Guide/Introduction) |
|
|
|
|
|
- [About this guide](/en-US/docs/Web/JavaScript/Guide/Introduction#where_to_find_javascript_information) |
|
|
- [About JavaScript](/en-US/docs/Web/JavaScript/Guide/Introduction#what_is_javascript) |
|
|
- [JavaScript and Java](/en-US/docs/Web/JavaScript/Guide/Introduction#javascript_and_java) |
|
|
- [ECMAScript](/en-US/docs/Web/JavaScript/Guide/Introduction#javascript_and_the_ecmascript_specification) |
|
|
- [Tools](/en-US/docs/Web/JavaScript/Guide/Introduction#getting_started_with_javascript) |
|
|
- [What's next](/en-US/docs/Web/JavaScript/Guide/Introduction#whats_next) |
|
|
|
|
|
## Grammar and types |
|
|
|
|
|
Overview: [Grammar and types](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types) |
|
|
|
|
|
- [Basic syntax & comments](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#basics) |
|
|
- [Declarations](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#declarations) |
|
|
- [Variable scope](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#variable_scope) |
|
|
- [Variable hoisting](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#variable_hoisting) |
|
|
- [Data structures and types](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#data_structures_and_types) |
|
|
- [Literals](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#literals) |
|
|
|
|
|
## Control flow and error handling |
|
|
|
|
|
Overview: [Control flow and error handling](/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling) |
|
|
|
|
|
- [`if...else`](/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#if...else_statement) |
|
|
- [`switch`](/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#switch_statement) |
|
|
- [`try`/`catch`/`throw`](/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#exception_handling_statements) |
|
|
- [Error objects](/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#utilizing_error_objects) |
|
|
|
|
|
## Loops and iteration |
|
|
|
|
|
Overview: [Loops and iteration](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration) |
|
|
|
|
|
- [`for`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#for_statement) |
|
|
- [`while`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#while_statement) |
|
|
- [`do...while`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#do...while_statement) |
|
|
- [`continue`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#continue_statement) |
|
|
- [`break`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#break_statement) |
|
|
- [`for...in`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#for...in_statement) |
|
|
- [`for...of`](/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_statement) |
|
|
|
|
|
## Functions |
|
|
|
|
|
Overview: [Functions](/en-US/docs/Web/JavaScript/Guide/Functions) |
|
|
|
|
|
- [Defining functions](/en-US/docs/Web/JavaScript/Guide/Functions#defining_functions) |
|
|
- [Calling functions](/en-US/docs/Web/JavaScript/Guide/Functions#calling_functions) |
|
|
- [Function scopes and closures](/en-US/docs/Web/JavaScript/Guide/Functions#function_scopes_and_closures) |
|
|
- [Arguments](/en-US/docs/Web/JavaScript/Guide/Functions#using_the_arguments_object) & [parameters](/en-US/docs/Web/JavaScript/Guide/Functions#function_parameters) |
|
|
- [Arrow functions](/en-US/docs/Web/JavaScript/Guide/Functions#arrow_functions) |
|
|
|
|
|
## Expressions and operators |
|
|
|
|
|
Overview: [Expressions and operators](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators) |
|
|
|
|
|
- [Assignment](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#assignment_operators) & [Comparisons](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#comparison_operators) |
|
|
- [Arithmetic operators](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#arithmetic_operators) |
|
|
- [Bitwise](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#bitwise_operators) & [logical operators](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#logical_operators) |
|
|
- [Conditional (ternary) operator](/en-US/docs/Web/JavaScript/Guide/Expressions_and_operators#conditional_ternary_operator) |
|
|
|
|
|
## Numbers and strings |
|
|
|
|
|
Overview: [Numbers and strings](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings) |
|
|
|
|
|
- [Numbers](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#numbers) |
|
|
- [`Number` object](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#number_object) |
|
|
- [`Math` object](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#math_object) |
|
|
- [Strings](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#strings) |
|
|
- [`String` object](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#string_object) |
|
|
- [Template literals](/en-US/docs/Web/JavaScript/Guide/Numbers_and_strings#template_literals) |
|
|
|
|
|
## Representing dates & times |
|
|
|
|
|
Overview: [Representing dates & times](/en-US/docs/Web/JavaScript/Guide/Representing_dates_times) |
|
|
|
|
|
- [`Date` object](/en-US/docs/Web/JavaScript/Guide/Representing_dates_times#date_object) |
|
|
|
|
|
## Regular expressions |
|
|
|
|
|
Overview: [Regular expressions](/en-US/docs/Web/JavaScript/Guide/Regular_expressions) |
|
|
|
|
|
- [Creating a regular expression](/en-US/docs/Web/JavaScript/Guide/Regular_expressions#creating_a_regular_expression) |
|
|
- [Writing a regular expression pattern](/en-US/docs/Web/JavaScript/Guide/Regular_expressions#writing_a_regular_expression_pattern) |
|
|
- [Assertions](/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Assertions) |
|
|
- [Character classes](/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes) |
|
|
- [Groups and backreferences](/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Groups_and_backreferences) |
|
|
- [Quantifiers](/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Quantifiers) |
|
|
|
|
|
## Indexed collections |
|
|
|
|
|
Overview: [Indexed collections](/en-US/docs/Web/JavaScript/Guide/Indexed_collections) |
|
|
|
|
|
## Keyed collections |
|
|
|
|
|
Overview: [Keyed collections](/en-US/docs/Web/JavaScript/Guide/Keyed_collections) |
|
|
|
|
|
- [`Map`](/en-US/docs/Web/JavaScript/Guide/Keyed_collections#map_object) |
|
|
- [`WeakMap`](/en-US/docs/Web/JavaScript/Guide/Keyed_collections#weakmap_object) |
|
|
- [`Set`](/en-US/docs/Web/JavaScript/Guide/Keyed_collections#set_object) |
|
|
- [`WeakSet`](/en-US/docs/Web/JavaScript/Guide/Keyed_collections#weakset_object) |
|
|
|
|
|
## Working with objects |
|
|
|
|
|
Overview: [Working with objects](/en-US/docs/Web/JavaScript/Guide/Working_with_objects) |
|
|
|
|
|
- [Objects and properties](/en-US/docs/Web/JavaScript/Guide/Working_with_objects#objects_and_properties) |
|
|
- [Creating objects](/en-US/docs/Web/JavaScript/Guide/Working_with_objects#creating_new_objects) |
|
|
- [Defining methods](/en-US/docs/Web/JavaScript/Guide/Working_with_objects#defining_methods) |
|
|
- [Getter and setter](/en-US/docs/Web/JavaScript/Guide/Working_with_objects#defining_getters_and_setters) |
|
|
|
|
|
## Using classes |
|
|
|
|
|
Overview: [Using classes](/en-US/docs/Web/JavaScript/Guide/Using_classes) |
|
|
|
|
|
- [Declaring a class](/en-US/docs/Web/JavaScript/Guide/Using_classes#declaring_a_class) |
|
|
- [Various class features](/en-US/docs/Web/JavaScript/Guide/Using_classes#constructor) |
|
|
- [Extends and inheritance](/en-US/docs/Web/JavaScript/Guide/Using_classes#extends_and_inheritance) |
|
|
- [Why classes?](/en-US/docs/Web/JavaScript/Guide/Using_classes#why_classes) |
|
|
|
|
|
## Promises |
|
|
|
|
|
Overview: [Promises](/en-US/docs/Web/JavaScript/Guide/Using_promises) |
|
|
|
|
|
- [Guarantees](/en-US/docs/Web/JavaScript/Guide/Using_promises#guarantees) |
|
|
- [Chaining](/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) |
|
|
- [Error handling](/en-US/docs/Web/JavaScript/Guide/Using_promises#error_handling) |
|
|
- [Composition](/en-US/docs/Web/JavaScript/Guide/Using_promises#composition) |
|
|
- [Timing](/en-US/docs/Web/JavaScript/Guide/Using_promises#timing) |
|
|
|
|
|
## Typed arrays |
|
|
|
|
|
Overview: [Typed arrays](/en-US/docs/Web/JavaScript/Guide/Typed_arrays) |
|
|
|
|
|
## Iterators and generators |
|
|
|
|
|
Overview: [Iterators and generators](/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators) |
|
|
|
|
|
- [Iterators](/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators#iterators) |
|
|
- [Iterables](/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators#iterables) |
|
|
- [Generators](/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators#generator_functions) |
|
|
|
|
|
## Resource management |
|
|
|
|
|
Overview: [JavaScript resource management](/en-US/docs/Web/JavaScript/Guide/Resource_management) |
|
|
|
|
|
- [The `using` and `await using` declarations](/en-US/docs/Web/JavaScript/Guide/Resource_management#the_using_and_await_using_declarations) |
|
|
- [The `DisposableStack` and `AsyncDisposableStack` objects](/en-US/docs/Web/JavaScript/Guide/Resource_management#the_disposablestack_and_asyncdisposablestack_objects) |
|
|
- [Error handling](/en-US/docs/Web/JavaScript/Guide/Resource_management#error_handling) |
|
|
|
|
|
## Internationalization |
|
|
|
|
|
Overview: [Internationalization](/en-US/docs/Web/JavaScript/Guide/Internationalization) |
|
|
|
|
|
- [Date and time formatting](/en-US/docs/Web/JavaScript/Guide/Internationalization#date_and_time_formatting) |
|
|
- [Number formatting](/en-US/docs/Web/JavaScript/Guide/Internationalization#number_formatting) |
|
|
- [Collation](/en-US/docs/Web/JavaScript/Guide/Internationalization#collation) |
|
|
|
|
|
## JavaScript modules |
|
|
|
|
|
Overview: [JavaScript modules](/en-US/docs/Web/JavaScript/Guide/Modules) |
|
|
|
|
|
- [Exporting](/en-US/docs/Web/JavaScript/Guide/Modules#exporting_module_features) |
|
|
- [Importing](/en-US/docs/Web/JavaScript/Guide/Modules#importing_features_into_your_script) |
|
|
- [Default exports](/en-US/docs/Web/JavaScript/Guide/Modules#default_exports_versus_named_exports) |
|
|
- [Renaming features](/en-US/docs/Web/JavaScript/Guide/Modules#renaming_imports_and_exports) |
|
|
- [Aggregating modules](/en-US/docs/Web/JavaScript/Guide/Modules#aggregating_modules) |
|
|
- [Dynamic module loading](/en-US/docs/Web/JavaScript/Guide/Modules#dynamic_module_loading) |
|
|
|
|
|
## Advanced topics |
|
|
|
|
|
After you have learned all fundamental features of JavaScript, you can explore some more niche features, or dive deeper into the language's mechanisms and concepts. |
|
|
|
|
|
- [Language overview](/en-US/docs/Web/JavaScript/Guide/Language_overview) |
|
|
- [Data structures](/en-US/docs/Web/JavaScript/Guide/Data_structures) |
|
|
- [Enumerability and ownership of properties](/en-US/docs/Web/JavaScript/Guide/Enumerability_and_ownership_of_properties) |
|
|
- [Inheritance and the prototype chain](/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain) |
|
|
- [Equality comparisons and sameness](/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness) |
|
|
- [Closures](/en-US/docs/Web/JavaScript/Guide/Closures) |
|
|
- [Meta programming](/en-US/docs/Web/JavaScript/Guide/Meta_programming) |
|
|
- [Memory management](/en-US/docs/Web/JavaScript/Guide/Memory_management) |
|
|
|
|
|
{{Next("Web/JavaScript/Guide/Introduction")}} |
|
|
|