Why String is immutable in JavaScript? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
JavaScript strings are immutable. This means that once a string is created, it is not possible to modify it. However, it is still possible to create another string based on an operation on the original string
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
I understand what immutable mean, but i need to know why they built it like this and what the value of this immutable approach?
Note: I reviewed some Java reference but I'm not Java developer, and I can't understand there terms (StringPool, hashcode ...)

Related

How would you name a JavaScript getter function that throws an error if not found vs one that returns null? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
In JavaScript, how would you name a getter function that will throw an error if the item is not found vs one that will return null if not found? In Ruby we can do things like find() and find!(). Anybody have a good way to name these in JS? Best I can think of is getThing() and getThingSafe().
As far as I remember most common pattern is to name it as getThing() for nullable and getThingOrThrow() for throwable methods. For example ts-morph makes it's functions this way

Is there a substantial feature, performance or compatibility difference between Underscore.js's _.map() and JavaScript's native .map()? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
Is there any reason to use _.map() when JavaScript already implements .map()?
Key word, that is also wrong: "already."
Underscore's is older. It has not been removed (and shouldn't be, because that would break legacy code).

What would be the easiest way to parse JSON in C# for a developer having a background in Javascript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have a background of Javascript where parsing JSON was dead simple and you had not to worry about types and the stuff at all, now I have to do the same using C#. I need to write a program which will parse swagger definition (like this one) and later I will have to iterate over it, would you advise the easiest way ahead? Thank you!
Probably, the easiest way is to use Json.NET. It has ability to do the following:
dynamic d = JObject.Parse("{id: 1, name:'name'}");
And then access properties of dynamic object like this:
d.id
d.name
Here is an exapmle with array:
http://www.newtonsoft.com/json/help/html/QueryJsonDynamic.htm

Do I need to learn OOP before learn Angular JS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have good knowledge of HTML CSS Bootstrap and Basic knowledge of Javascript & Jquery so do I need to clear all Object oriented programming before jump on Angular?
Yes you should, but not just because of angular. For complex applications an Object oriented Structure is always a good decision, because it will help you to represent an subset of the reality in your application

Javascript compiler in C? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm looking for a simple (preferably C-based) Javascript compiler that I can use to determine if a chunk of Javascript contains any syntax errors, and the location (line number) of those errors. Is there a small library that anyone knows of that I can use to do something like this?
The V8 isn't good enough for you?
You could also try SpiderMonkey by Mozilla

Categories