In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "whether javascript is a strongly typed language". Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn whether javascript is a strongly typed language.
Javascript is not a strongly typed language, but a weakly typed language. JavaScript is a dynamically typed, weakly typed, prototype-based language that allows implicit conversions of variable types, mandatory type conversions, etc., such as strings and values that can be converted automatically, while strongly typed languages generally do not allow this.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
JavaScript is a literal scripting language, a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter, known as the javascript engine, is a part of the browser and is widely used in the client scripting language. It was first used on HTML pages to add dynamic functions to HTML pages. JavaScript is compatible with the ECMA standard, so it is also called ECMAScript.
Weakly typed languages:
A language in which data types can be ignored. In contrast to strongly typed definition languages, a variable can assign values of different data types.
Weakly typed languages allow implicit conversions of variable types, mandatory type conversions, etc., such as strings and values that can be converted automatically, while strongly typed languages generally do not allow this.
The embodiment of js weak type
The general rule is that the stronger the constraint, the less likely it is to make mistakes, but the more troublesome it is to write programs. In JavaScript, this error is easy to occur because the constraints are weak: the simplest example:
Var a = 200; var b = "1"; var c = a + b
You might expect c to be 201, but in fact it is "2001", an error that never occurs in strongly typed languages. However, it is precisely because JavaScript does not have these constraints that you can easily concatenate numeric and string types.
Another example is the following:
Var a ='11 destroy a = a -'; alert (typeof a); / /-- > number
"-" can be either a unary operator (minus) or a binary (subtraction)
In a loop statement (if,while), an Object object can be implicitly converted from a Boolean value.
Var obj = {name:'jack'} if (obj) {/ / do more} so far, I believe you have a better understanding of "whether javascript is a strongly typed language". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.