Definitive guide for javascript

Getting started with JavaScript : The Definitive Guide

I started reading out this book a week ago and here I’m trying to break-up a few things I understood while getting started.

Chapter 01 : Introduction to JavaScript.

JavaScript is a high-level, dynamic, interpreted programming language that is well suited to Object oriented and functional programming styles with multi-paradigm. It has curly-bracket syntax, prototype-based object-orientation, and first-class functions. It is basically everywhere around us.
I know what you’re thinking. Alright, I accept these are a lot of jargons to take in abruptly. So let’s get our feet into the deep waters one foot at a time. What is High-level Programming language?
In computer science it can be explained as a programming language that uses abstraction(providing relevant information in a type). Means we all know machine cannot understand natural languages that humans speak. They only understand the binary or machine level language, which consists of only zeroes and ones. Now what earlier software engineers did for us was they kind of made a dictionary in which they wrote down sequences of 0’s and 1’s so that when we type something in our natural language the machine will have a reference to look up to, to understand what it exactly means in machine level language. Alt Text A dynamic programming language is nothing but just a class of high level programming language in which operations otherwise done at compile-time can be done at run-time. In JavaScript it is possible to change the type of a variable or add new properties or methods to an object while the program is running. This is the ability of a dynamic language.
Interpreters run through a program line by line and execute each command so if a command in JavaScript is executed, that is done in the manner previously mentioned and thus becomes an interpreted language. The point to note here is that in compiled languages that are directly converted into machine code, they tend to be faster than interpreted languages. But with the development of JUST-IN-TIME compilation the gap is shrinking. Alt Text

Chapter 02 : Lexical Structure.

  1. JavaScript is a case-sensitive language.
  2. JavaScript ignores excess whitespace along with line breaks except for those that are a part of string or regular expression literals.
  3. Currently according to ECMAScript 6 there are total of 48 reserved keywords in JavaScript.
  4. JavaScript programs are written using the Unicode character set.
  5. Semicolons are optional.
  6. Primitive types (inbuilt or predefined datatypes and methods linked to them).

We will continue to discuss the further chapters.
If you think this article can be improved do let me know. 🙂

Top comments (4)

I am a Full stack .NET Developer, I like to work with C#, Asp.Net Core, SQL, Mongo DB, Azure, JavaScript. Always eager to learn new technologies. I am here to share, ask & eventually learn.

Читайте также:  Узнать позицию элемента javascript

Nice, 😄, So Javascript and Pyhton being a interpreted language is slow compared to compiled languages like C, C++, C# and Java ?

Then how come Node.Js is fast, its also Javascript right ?

2 likes Like Comment button

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A great book to get for extensive deep understanding and have a solid foundation of JavaScript advanced concepts.

AmazingBooks/Javascript-Definitive-Guide

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A great book to get for extensive deep understanding and have a solid foundation of JavaScript advanced concepts. JavaScript: The Definitive Guide it is the bible for JavaScript programmers—a programmer’s guide and comprehensive reference to the core language and to the client-side JavaScript APIs defined by web browsers.

«A must-have reference for expert JavaScript programmers. well-organized and detailed.» —Brendan Eich, creator of JavaScript, CTO of Mozilla

The Summary below is only for certain Javascript key concepts which can also assist you either for interview questions or when you need to find a quick reference while coding.

Chapter 6 — Understanding Objects

What is an Object in Javascript?

Is a fundamental datatype, unordered collection of properties and composite values. An Object aggregates multiple values (primitive values or other objects) and allows you to store and retrieve those values by name. In addition to maintaining its own set of properties, a JavaScript object also inherits the properties of another object, known as its “prototype”. The methods of an object are typically inherited properties, and this “prototypal inheritance” is a key feature of JavaScript. The most common things to do with objects are create, set, query, delete, test, and enumerate their Properties.

Great, so what is a Property?

  • A Property has a name and a value.
  • A property name may be any string, including the empty string, but no object may have two properties with the same name.
  • The value may be any JavaScript value, even a getter or a setter function (or both).
  • Also each Property has associated values called Property Attributes:
    • The Writable Attribute specifies whether the value of the property can be set.
    • The Enumerable Attribute specifies whether the property name is returned by a for/in loop.
    • The Configurable Attribute specifies whether the property can be deleted and whether its attributes can be altered.

    What do I need to know about Objects in Javascript:

    1. Mutable — objects are mutable and are manipulated by reference rather than by value; If the variable x refers to an object, and the code var y = x; is executed, the variable y holds a reference to the same object, not a copy of that object. Any modifications made to the object through the variable y are also visible through the variable x.
    2. In Javascript there are 3 board Categories of Objects and 2 types of properties:

    Those 3 Categories of Objects are:

    • Native Object — object or class of objects defined by the ECMAScript specification like Arrays, Functions, Dates, and regular expressions (for example) are native objects.
    • Host Object — Object defined by the host environment (such as a web browser) within which the JavaScript interpreter is embedded. The HTMLElement objects that represent the structure of a web page in client-side JavaScript are host objects.
    • User-defined Object — any object created by the execution of JavaScript code.

    Those 2 Categories of Properties are:

    • Own Property — a property defined directly on an Object.
    • Inherited Property — a property defined by an Object’s prototype object.
    1. Multiple ways to instantiate an Object:
    • There are a couple of ways to create, or instantiate, objects. The first is to use the new operator with a constructor. (A constructor is simply a function that uses new to create an object—any function can be a constructor.)
    //this code instantiates a generic object and stores a reference to it in object: var object = new Object();

    Some commune Questions regarding Objects in Javascript

    Is a Javascript Object Dynamic?

    Yes, JavaScript objects are dynamic—properties and can usually be added, deleted, used to simulate the static objects and “structs” of statically typed languages and they can represent sets of strings.

    So Everything in Javascript is an Object?

    Almost, everything is an Object except the primitive values: String, Number, True, False, Null, Undefined. And even though strings, numbers, and booleans are not objects, they behave like immutable objects

    Prototypes — What are Prototypes?

    Every JavaScript object has a second JavaScript object. This second object is known as a prototype, and the first object inherits properties from the prototype. A Prototype is simply a reference to another object. Almost all objects are given a non-null value for this property, at the time of their creation.

    var myObject =  a: 2 >; myObject.a; // 2

    Objects created by object literals have the same prototype object, and we can refer to this prototype object in JavaScript code as Object.prototype. Object.prototype is one of the rare objects that has no prototype: it does not inherit any properties. All of the built-in constructors (and most user-defined constructors) have a prototype that inherits from Object.prototype. For example, Date.prototype inherits properties from Object.prototype, so a Date object created by new Date() inherits properties from both Date.prototype and Object.prototype. This linked series of prototype objects is known as a prototype chain. An explanation of how property inheritance works is in Inheritance (see section below).

    JavaScript objects have a set of “own properties,” and they also inherit a set of properties from their prototype object. To understand this, we must consider property access in more detail.

    We can query the Prototype of an Object by using the prototype Attribute since every object has associated prototype, class, and extensible attributes.

    What is an Object Prototype Attribute? — An object’s prototype attribute specifies the object from which it inherits properties. The prototype attribute is set when an object is created. To determine whether one object is the prototype of (or is part of the prototype chain of) another object, use the isPrototypeOf() method. For example:

    var p = x:1>; // Define a prototype object. var o = Object.create(p); // Create an object with that prototype. p.isPrototypeOf(o) // => true: o inherits from p Object.prototype.isPrototypeOf(o) // => true: p inherits from Object.prototype

    About

    A great book to get for extensive deep understanding and have a solid foundation of JavaScript advanced concepts.

    Источник

    JavaScript: The Definitive Guide, 5th Edition

    JavaScript: The Definitive Guide, 5th Edition

    Read it now on the O’Reilly learning platform with a 10-day free trial.

    O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

    Book description

    This Fifth Edition is completely revised and expanded to cover JavaScript as it is used in today’s Web 2.0 applications. This book is both an example-driven programmer’s guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including:

    • Scripted HTTP and Ajax
    • XML processing
    • Client-side graphics using the canvas tag
    • Namespaces in JavaScript—essential when writing complex programs
    • Classes, closures, persistence, Flash, and JavaScript embedded in Java applications

    Part I explains the core JavaScript language in detail. If you are new to JavaScript, it will teach you the language. If you are already a JavaScript programmer, Part I will sharpen your skills and deepen your understanding of the language.

    Part II explains the scripting environment provided by web browsers, with a focus on DOM scripting with unobtrusive JavaScript. The broad and deep coverage of client-side JavaScript is illustrated with many sophisticated examples that demonstrate how to:

    • Generate a table of contents for an HTML document
    • Display DHTML animations
    • Automate form validation
    • Draw dynamic pie charts
    • Make HTML elements draggable
    • Define keyboard shortcuts for web applications
    • Create Ajax-enabled tool tips
    • Use XPath and XSLT on XML documents loaded with Ajax
    • And much more

    Part III is a complete reference for core JavaScript. It documents every class, object, constructor, method, function, property, and constant defined by JavaScript 1.5 and ECMAScript Version 3.

    Part IV is a reference for client-side JavaScript, covering legacy web browser APIs, the standard Level 2 DOM API, and emerging standards such as the XMLHttpRequest object and the canvas tag.

    More than 300,000 JavaScript programmers around the world have madethis their indispensable reference book for building JavaScript applications.

    «A must-have reference for expert JavaScript programmers. well-organized and detailed.»
    — Brendan Eich, creator of JavaScript

    Источник

Оцените статью