Questions tagged [javascript]
For questions about JavaScript's design, or languages which are closely related to JavaScript.
11 questions
1
vote
1
answer
326
views
In Angular `@if` statement, when referencing the conditional expression's result as a variable, why do you put the `;` before `as`?
Take this example program in modern Angular:
@if (user.profile.settings.startDate; as startDate) {
{{ startDate }}
}
Why does there need to be a ...
0
votes
0
answers
145
views
In Angular control flow, why are `@if` and `@else` preceded by `@`, but the `if` in `@else if` is spelt without a `@` at the beginning?
In new versions of Angular, you do control flow like this:
...
1
vote
1
answer
242
views
In the old Angular, why did `[ngSwitch]` go into square brackets, but `*ngSwitchCase` was preceded by `*`? Wouldn't `*ngSwitch` make more sense?
In the old versions of Angular (before the @if, @for, and @switch), why did ...
2
votes
1
answer
333
views
Is `WebAssembly` (the object through which WebAssembly and JavaScript programs communicate) considered to be a host object or a native object?
In our front-end developer course at Algebra, we are being taught there are three different types of objects in JavaScript:
Native objects - those that are defined by JavaScript itself, such as ...
16
votes
3
answers
5k
views
Why did C++ standard library name the containers map and unordered_map instead of map and ordered_map?
This is something that has slightly annoyed me for a while. A map as a mathematical object (function) is by default "unordered", and the same is for maps as a data structure AKA associative ...
1
vote
2
answers
976
views
What is the difference between JS's map and Python's dictionary?
It seems that JS's map and Python's dictionary are equivalent. Is that correct? And if so, why they aren't called the same? Given that JS is newer, why wouldn't the map be called as dictionary as well?...
2
votes
1
answer
598
views
Is it correct that Python does not encourage us to read objects's content? [closed]
After playing around Python a little bit, I feel like Python does not encourage us to read objects's content. Take JavaScript for example: just a simple act of calling an object will list all the ...
3
votes
1
answer
662
views
Why is the ECMAScript specification formatted the way it is? [closed]
The ECMAScript specification and its drafts are very accessible, but they're formatted a bit oddly -- case in point, the current version of the ToBigInt abstract operation uses three fonts:
The base (...
30
votes
1
answer
4k
views
Why did JavaScript choose to include a void operator?
In JavaScript, there is an operator void that, given an expression, evaluates it but then ignores the result and evaluates to ...
8
votes
1
answer
389
views
Why do many dynamically typed languages identify types with strings?
I noticed in JavaScript and Lua, 'types' i.e., those returned by typeof()/type() are just identified by strings. As such we see ...
12
votes
6
answers
1k
views
What do various designers of JavaScript regret or dislike about its design? Given the opportunity, what would they do differently and why?
And are there underlying, unifying patterns to these regrets and how said creators would choose to create a revolutionary (in the sense of being "more than evolutionary" / making significant ...