Front--js

Source: Internet
Author: User
Tags script tag

JavaScript introduces the history of JavaScript
    • 1992 Nombas developed the embedded scripting language for C-minus-minus (c--), which was originally bound to Cenvi software, and renamed it Scriptease (the language that the client executes).
    • Netscape (Netscape) received Nombas's philosophy, (Brendan Eich) developed a set of Netscape scripting languages in its Navigator livescript 2.0 product. Sun and Netscape were done together, and then renamed JavaScript.
    • Microsoft then emulated a JavaScript clone called JScript in its IE3.0 product.
    • To unify the three, the ECMA ( European Computer Manufacturing Association) defines the ECMA-262 specification. The International Organization for Standardization (ISO/IEC) also adopted ECMAScript as the standard (iso/iec-16262). Since then, Web browsers have struggled (albeit with varying degrees of success and failure) to ECMAScript as the basis for JAVASCRIPT implementations.
    • ECMA-262 is the official name of the JavaScript standard.
ECMAScript
Year Name Describe
1997 ECMAScript 1 First version
1998 ECMAScript 2 Version change
1999 ECMAScript 3

To add a regular expression

Add Try/catch

ECMAScript 4 Not published
2009 ECMAScript 5

Add "strict mode" strict modes

Add JSON support

2011 ECMAScript 5.1 Version change
2015 ECMAScript 6 adding classes and modules
2016 ECMAScript 7

Increase the exponential operator (* *)

Increase Array.prototype.includes

Note: ES6 refers to ECMASCRIPT6.

Although ECMAScript is an important standard, it is not the only part of JavaScript, and certainly not the only one that is standardized. In fact, a finished JavaScript implementation is made up of the following 3 different parts:

Core (ECMAScript)

Document Object Model (DOM) Documents object models (consolidated js,css,html)

Browser object models (BOM) Broswer object Model (integrated JS and browser)

Simply put, Ecmacript describes the content of the JavaScript language itself.

JavaScript is a scripting language like the shell

JavaScript is a lightweight programming language

JavaScript is a programmatic code that can be inserted into an HTML page.

When JavaScript is inserted into an HTML page, it can be performed by all modern browsers.

JavaScript is simple and easy to get started with.

How JavaScript is introduced

Write code inside the script tag

<script>  //  Write your JS code here </script>

Introduction of additional JS files

<script src= "Test.js" ></script>
JavaScript Language Specification

Comments

// This is a single-line comment /* This is a multi-line comment */

Terminator

The statements in JavaScript are separated by semicolons; As a terminator.

JavaScript Language Basics

Variable declaration

A variable name of 1.JavaScript can be made up of _, number, letter, $, and cannot begin with a number.

2. Declare variables using var variable name; The format to declare

var name = "Alex"; var age = 18;

Attention:

Variable names are case-sensitive.

Camel-named rules are recommended.

Reserved words cannot be used as variable names.

Abstract Boolean byte Char Classconst Debugger Double enumexportextendsfinal float Gotoimplementsimport int Interface Long Nativepackageprivateprotectedpublic  Short Staticsupersynchronizedthrowstransientvolatile
reserved word listJavaScript data types

JavaScript has a dynamic type

var x;  // at this point x is undefined var x = 1;  // at this point x is the number var x = "Alex"  //

Number Type

JavaScript does not differentiate between integer and floating point, there is only one numeric type.

var a = 12.34; var b =; var c = 123e5;  // 12300000 var d = 123e-5;  // 0.00123

There is also a Nan, which indicates that it is not a number.

Common ways:

parseint ("123")  //  return 123parseint ("ABC")  //  return Nan,nan property is a special value that represents a non-numeric value. This property is used to indicate that a value is not a number. parsefloat ("123.456")  //  return to 123.456

String

var a = "Hello"var b = "world;var c = a + B; Console.log (c);  Get HelloWorld

Common methods:

Method Description
. length return length
. Trim () Remove whitespace
. Trimleft () Remove the left margin
. TrimRight () Remove the blank on the right
. CharAt (N) Returns the nth character
. concat (value, ...) Stitching
. indexOf (substring, start) Sub-sequence position
. substring (from, to) Get sub-sequences by index
. Slice (start, end) Slice
. toLowerCase () Lowercase
. toUpperCase () Capital
. Split (delimiter, limit) Segmentation

Splicing strings generally use "+"

>> stop does not swap both if start is less than 0, then the cut starts at the end of the string, starting at the beginning of the first (including the character at that position) if stop is less than 0, then cutting the ABS from the end of the string forward (stop) character end (does not contain the position character)
the difference between slice and substring

Common methods:

Method Description
. length The size of the array
. push (Ele) Trailing append Element
. Pop () Gets the trailing element
. Unshift (Ele) Head Insert Element
. Shift () Removing elements from the head
. Slice (start, end) Slice
. Reverse () Reverse
. Join (SEQ) Concatenate array elements into a string
. concat (Val, ...) Connection array
. Sort () Sort

Front--js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.