+ 8
Why JavaScript is considered weakly typed scripting language..........??
JavaScript is, technically speaking, an object-oriented, weakly typed, scripting language.
6 odpowiedzi
+ 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”
+ 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)
+ 6
lol, answered ur own question. And educated some people. That's what makes it worth it.
+ 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.
+ 2
Why is that?
What makes it a weakly typed language?
+ 2
@Epic
That makes sense.
Thank you, for explaining it to me.