Git Product home page Git Product logo

sami12344 / javascript_revision_01 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.77 MB

JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.

HTML 1.86% JavaScript 98.14%

javascript_revision_01's Introduction

image JavaScript

JavaScript is a high-level, interpreted programming language primarily used for creating interactive elements on websites, enables developers to manipulate web page elements, handle events, and validate forms. JavaScript runs on the client-side, making it a crucial tool for web development. Its versatility and extensive libraries contribute to its widespread adoption and its role in creating dynamic and engaging web experiences.


AboutBookFeaturesDocumentationLicense

About

JavaScript is a powerful programming language that was introduced in 1995. It quickly became an essential tool for web development, allowing developers to add interactive and dynamic elements to websites. Over the years, JavaScript has evolved and grown in popularity, becoming one of the most widely used programming languages in the world.

One of the key features of JavaScript is its ability to run on the client-side, meaning it can be executed directly in a user's web browser without the need for server-side processing. This enables developers to create rich, interactive web applications that respond to user actions in real-time.

JavaScript is a versatile language that can be used for a wide range of tasks, from simple form validation to complex web applications. It provides a robust set of built-in functions and libraries, making it easy to manipulate web page elements, handle events, and perform calculations. Additionally, JavaScript can interact with other web technologies such as HTML and CSS, allowing developers to create seamless and immersive user experiences.

Furthermore, JavaScript has expanded beyond the browser and is now used in server-side environments with the introduction of frameworks like Node.js. This has opened up new possibilities for building full-stack applications using a single programming language.

With its widespread adoption and continuous development, JavaScript continues to shape the modern web landscape, empowering developers to create dynamic and interactive experiences for users across the globe.

Book

The book I used to learn JavaScript is "JavaScript: The Definitive Guide, 7th Edition"

"JavaScript: The Definitive Guide, 7th Edition" is a comprehensive and highly regarded book written by David Flanagan. Serving as a definitive resource for JavaScript developers, it offers a deep dive into the intricacies of the language.

The book covers a wide range of topics, starting from the basics of JavaScript syntax and data types. It then progresses to more advanced concepts, such as functions, objects, arrays, and regular expressions. The author also delves into the complexities of the Document Object Model (DOM) and browser-specific JavaScript APIs.

In addition to covering the fundamentals, the 7th edition of the book incorporates the latest updates and modern features of JavaScript. It explores essential topics like modules, promises, generators, and the async/await syntax, enabling readers to leverage the full power of contemporary JavaScript development.

One of the strengths of "JavaScript: The Definitive Guide" lies in its clear and detailed explanations. The author provides numerous code examples and practical illustrations to reinforce understanding and facilitate hands-on learning. The book strikes a balance between theory and application, making it accessible to both beginners and seasoned developers seeking to deepen their knowledge.

This edition also includes insights into best practices and coding conventions, helping developers write clean, efficient, and maintainable JavaScript code. It equips readers with the tools and knowledge to build robust and scalable web applications.

Overall, "JavaScript: The Definitive Guide, 7th Edition" is an indispensable reference for JavaScript developers, providing a comprehensive understanding of the language and empowering them to write high-quality code.

JavaScript: The Definitive Guide, 7th Edition link

Features

Scripting

Javascript executes the client-side script in the browser.

Interpreter

The browser interprets JavaScript code.

vent Handling

Events are actions. Javascript provides event-handling options.

Light Weight

As Javascript is not a compiled language, source code never changes to byte code before running time. Low-end devices can also run Javascript because of its lightweight feature.

Case Sensitive

In Javascript, names, variables, keywords, and functions are case-sensitive.

Control Statements

Javascript has control statements like if-else-if, switch case, and loop. Users can write complex code using these control statements.

Objects as first-class Citizens

Javascript arrays, functions, and symbols are objects which can inherit the Object prototype properties. Objects being first-class citizens means Objects can do all tasks.

Supports Functional Programming

Javascript functions can be an argument to another function, can call by reference, and can assign to a variable.

Dynamic Typing

Javascript variables can have any value type. The same variable can have a string value, an integer value, or any other.

Client-side Validations

Javascript client-side validations allow users to submit valid data to the server during a form submission.

Platform Independent

Javascript will run in the same way in all systems with any operating system.

Async Processing

Javascript async-await and promise features provide asynchronous nature. As the processes run in parallel, it improves processing time and responsiveness.

Prototype-based

Javascript follows 'Object.prototype' functions instead of class inheritance.

Nullish Coalescing Operator (??)

The nullish coalescing operator returns the right side operand if the left side operand is null. If the left operand is not 'null', the operator returns the left side operand value. This operator helps to avoid Boolean operator errors.

Logical nullish assignment (??=)

It is the shorthand of

result = left ?? right

Styling Console Log

Javascript consoles can have styles. For example, see the block below.

console.log('%cText %cValue', 'color:black; cursor:pointer', 'color: green;')

The first set of styles applies to the first string with %c, and the second %c gets the second style set for the second string.

Object Shorthand

Object shorthand can save space and time by allowing users to use the same name for assigning variables and key values.

const name='Egan',
id=1;

//The above snippet can be as follows
const egan={
name,
id
}
console.log(egan);

//Output
{name:'Egan', id:1}

Optional chaining (?.)

Javascript optional chaining optimizes the general null check in the example below.

var obj={
   data:{
      id: 1;
   }
}

//General null check
if(obj.data && obj.data.id)

//Optional chaining
obj.data?.id

Defer/Async Loading

Javascript 'defer' and async download file during HTML parsing and optimizes page load time. Async scripts run immediately after the download. Defer scripts execute only in the Dom order.

Simple client-side Calculations

Javascript can execute simple client-side calculations on the browser.

Large Browser Control

Javascript gives priority to the browser over the server.

Date and Time Handling

Javascript has built-in functions for getting 'date' and time.

HTML Content Generation

Javascript allows users to add dynamic HTML content upon doing some action on the page.

The Browser And OS Detection

Javascript has built-in code to detect the browser that the user uses.

Let & Const Keywords

Javascript replaces the var keyword with the let and const keywords and has a block-level scope.

Arrow Functions

Javascript helps to optimize syntax in anonymous functions with the arrow function syntax.

Template Literal

Javascript permits saving a variable as a string and saves development time.

New Array Functions

Javascript array functions enable code optimization. The regular array has an integer index, and the associative array has string index.

Default Parameters

Javascript avoids error scenarios with undefined values using the default parameters.

Property Shorthand

Javascript has several shorthand methods like .get() that saves coding time and cost.

Similar Syntax of Java

Javascript syntax and Java syntax are more similar, and it helps developers to work in both programming languages.

If else Statement

Javascript 'if else' conditional statements perform logical operations.

Looping Statements

Javascript loops allow developers to run the same code multiple times using a loop.

BigInt

Javascript allows large integer values. Javascript engines support BigInt differently.

Dynamic Import

The Javascript dynamic import function allows adding any files at run time.

Promise.allSettled

Javascript Promise.allSettled method accepts the promise array only after resolving or rejecting all the promises.

String matchAll

Javascript string.matchAll() returns all the match groups in a regular expression.

globalThis

Javascript globalThis points to the global object without considering the window object or self-object.

Module Namespace Exports

Javascript Module Namespace import export syntax is as follows.

import * as utils from './utils.mjs'
export { utils }

Well Defined for-in Order

Javascript 'for(a in b)' had no execution order till 2020. ES2020 gave the specification.

Import.meta

Javascript import.meta gives the meta information of a script tag.

<script type='module' src='module.js'>
console.log(meta);
//Output
{url: 'file':'//home/user/module.js'}

Negative Indexing with .at()

Javascript array indexing with array length minus procedure is an old method. The function .at() can replace this task.

let arr = [10, 20, 30]
arr.at(2) //Prints 20

hasOwn

Javascript hasOwn property is an extension of hasOwnProperty. Javascript hasOwn is a static method.

let obj = Object.create(null);
obj.hasOwnProperty=function(){};
Object.hasOwnProperty(obj, 'hasOwnProperty');

//Cannot convert the object to the primitive value
Object.hasOwn(obj, 'hasOwnProperty'); //true
Class Static Block
Javascript classes can have static items.

class Color {
   static blue;
   static {
      this.blue = 'blueberry';
   }
}

Error Cause

Javascript Error class provides an error cause report as well.

throw new Error('Error message', { cause: rootCause })

Documentation

The documentation of JavaScript can be found here

License

MIT

javascript_revision_01's People

Contributors

sami12344 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.