Computer Science, asked by rishikasarpal5, 7 months ago

Please helpe with these questions! Mates ❤❤
No spam please!​

Attachments:

Answers

Answered by khushidewangan019
1

Answer:

ans of questions one java script

Explanation:

JavaScript is a very powerful client-side scripting language. JavaScript is used mainly for enhancing the interaction of a user with the webpage. In other words, you can make your webpage more lively and interactive, with the help of JavaScript. JavaScript is also being used widely in game development and Mobile application development.

JavaScript supports much of the structured programming syntax from C (e.g., if statements, while loops, switch statements, do while loops, etc.). One partial exception is scoping: JavaScript originally had only function scoping with var. ECMAScript 2015 added keywords let and const for block scoping, meaning JavaScript now has both function and block scoping. Like C, JavaScript makes a distinction between expressions and statements. One syntactic difference from C is automatic semicolon insertion, which allows the semicolons that would normally terminate statements to be omitted.[38]

Weakly typed Edit

JavaScript is weakly typed, which means certain types are implicitly cast depending on the operation used.[39]

The binary + operator casts both operands to a string unless both operands are numbers. This is because the addition operator doubles as a concatenation operator

The binary - operator always casts both operands to a number

Both unary operators (+, -) always cast the operand to a number

Values are casted to strings like the following[39]:

Strings are left as-is

Numbers are converted to their string representation

Arrays have their elements cast to strings after which they are joined by commas (,)

Other objects are converted to the string [object Object] where Object is the name of the constructor of the object

Values are casted to numbers by casting to strings and then casting the strings to numbers. These processes can be modified by defining toString and valueOf functions on the prototype for string and number casting respectively.

JavaScript has received criticism for the way it implements these conversions as the complexity of the rules can be mistaken for inconsistency[40][39]. For example, when adding a number to a string, the number will be cast to a string before performing concatenation, but when subtracting a number from a string, the string is cast to a number before performing subtraction.

JavaScript includes a number of quirks that have been subject to criticism[39]:

left operand operator right operand result

[](empty array) + [](empty array) ""(empty string)

[] (empty array) + {} (empty object) "[object Object]" (string)

false (boolean) + [] (empty array) "false" (string)

"123"(string) + 1 (number) "1231" (string)

"123" (string) - 1 (number) 122 (number)

Often also mentioned is {} + [] resulting in 0 (number). This is misleading: the {} is interpreted as an empty code block instead of an empty object, and the empty array is cast to a number by the remaining unary + operator. If you wrap the expression in parentheses ({} + []) the curly brackets are interpreted as an empty object and the result of the expression is "[object Object]" as expected[39].

Dynamic Edit

Typing

JavaScript is dynamically typed like most other scripting languages. A type is associated with a value rather than an expression. For example, a variable initially bound to a number may be reassigned to a string.[41] JavaScript supports various ways to test the type of objects, including duck typing.[42]

Run-time evaluation

JavaScript includes an eval function that can execute statements provided as strings at run-time.

Similar questions