Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Is ecmascript an interpreter?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "ecmascript is not an interpreter", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "ecmascript is not an interpreter" this article.

Ecmascript is the interpreter. Ecmascript is a script programming language standardized by Ecma International through ECMA-262. It is the interpreter and responsible for translation. It is the core of js language and describes the syntax and basic objects of js language.

The operating environment of this tutorial: windows7 system, ECMAScript version 6, Dell G3 computer.

A complete JavaScript implementation consists of the following three different parts:

ECMAScript: the core part of the language that describes the syntax and basic objects of the language.

Document object Model (Document Object Model,DOM): a web document operation standard that describes the methods and interfaces for dealing with web content.

Browser object Model (BOM): the basis of client and browser window operations, describing the methods and interfaces for interacting with browsers.

ECMAScript (es): responsible for translation, the core of js, interpreter.

ECMAScript, defined by ECMA-262, is an internationally accepted standard scripting language specification that has no dependency on Web browsers. The ECMA-262 standard mainly stipulates that the language consists of the following components:

Grammar

Variables and data types

Keywords and reserved words

Operator

Control statement

Object

ECMAScript version 5.0 was officially released in 2009. For a long time, javaScript was used according to the 5. 0 standard. In 2015, ECMAScript 6 released its official version, officially known as ECMAScript 2015. ECMAScript defines all the properties, methods, and objects of the scripting language. Therefore, when using web client script coding, you must follow the ECMAScript standard.

JS data type

5 basic data types: Undefined, Null, Boolean, Number, String,Symbol (new to es6)

1 complex type: object

5 reference types: Array,Object,Function,Date,RegExp

Three basic packaging types: Boolean,Number,String

Two kinds of single built-in objects: Global,Math

1. There are four ways to judge the data type

Typeof

Const a = "" console.log (typeof (a)) = > String const b = 1console.log (typeof (b)) = > Number const cconsole.log (typeof (c)) = > Undefined const d = [] console.log (typeof (d)) = > Object const e = {} console.log (typeof (e)) = > Object const f = nullconsole.log (typeof (f)) = > Object / / null as an object not yet created

Instanceof

This method is only suitable for judging object types.

Const arr = [] console.log (arr instanceof Array) = > true console.log (null instanceof Object)-- > false console.log ([function] instanceof Object | Function)-- > true

Object.prototype.toString.call ()

In this way, all data types can be detected and recommended. Because toString is the prototype method of Object, while Array Function and others are instances of Object. Have overridden the toString method. Returns a string of type

Object.prototype.toString.call (null) = > [object Null] Object.prototype.toString.call (Math) = > [object Math] Object.prototype.toString.call (function () {}) = > [object Function] Objdec.prototype.toString.call (new Date) = > [object Date] Object.prototype.toString.call (Symbol ()) = > [object Symbol] Object.prototupe.toString.call (undefined) = > [object Undefined] Object.prototype.toString.call (123) = > [object Number] Object. Prototype.toString.call (true) = > [object Boolean] Object.prototype.toString.call ('123') = > [object String] Object.prototype.toString.call ({}) = > [object Object] Object.prototype.toString.call ([]) = > [object Array]

Constructor

Determines the constructor of the object.

1. Null is the starting point of the js prototype chain, and there is no constructor

2. Undefined has no constructor

3. [] .constructor = = Array-- > true

The above is all the content of this article, "is ecmascript an interpreter or not?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report