+ 8

Why JavaScript is considered weakly typed scripting language..........??

JavaScript is, technically speaking, an object-oriented, weakly typed, scripting language.

16th Jul 2017, 5:55 PM
Msaligs
Msaligs - avatar
6 Antworten
+ 8
"weakly typed" means that variables and data can be easily converted from one type to another. For example, in JavaScript, you can create a number and then convert it to a string: var cost = 2; cost += ‘ dollars’; // cost is now a string: “2 dollars”
16th Jul 2017, 6:19 PM
Msaligs
Msaligs - avatar
+ 7
JavaScript is one of the most popular programming languages on earth and is used to add interactivity to webpages, process data, as well as create various applications (mobile apps, desktop apps, games, and more)
16th Jul 2017, 6:04 PM
mohammed al-sarem
mohammed al-sarem - avatar
+ 6
lol, answered ur own question. And educated some people. That's what makes it worth it.
16th Jul 2017, 6:53 PM
Russel Reeder
Russel Reeder - avatar
+ 5
Strong-typed language enforces the definition of data type, and, cross type operation requires type casting. A variable of a certain type may or may not be able to hold other types of data depending on its nature and/or data range. This is why C, C++, C#, Java are strong-typed language, you must define what type of value a variable will hold, and, unless some types are highly compatible you will most likely need to cast (convert) one type to another, otherwise you'll end up with exception, or worse, unexpected operation result. Weak-typed language does not require type definition for variables, and a variable can be assigned and reassigned to a different type of data, and data ranges simply doesn't matter. This is why JavaScript is a weak-typed language, there is no need for you to define a data type for a variable, you just declare a variable and it will hold whatever value or reference you assign to it.
17th Jul 2017, 7:18 AM
Ipang
+ 2
Why is that? What makes it a weakly typed language?
16th Jul 2017, 5:58 PM
Manual
Manual - avatar
+ 2
@Epic That makes sense. Thank you, for explaining it to me.
16th Jul 2017, 6:38 PM
Manual
Manual - avatar