Is javascript a good language to learn?

Im a CS freshman and we learned a bit of java already. I was wondering if javascript would be worth learning. Is it a good language?

Attached: JavaScript-logo.png (1052x1052, 10K)

Other urls found in this thread:

node-os.com/
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array
twitter.com/AnonBabble

No

Why

Yes

yes

it's unironically the past, the present and the future

If you want to give anything that runs in a browser any behavior whatsoever JS is the only way

No. Learn a real fucking language.

I would recommend learning C and JavaScript as first two languages.

Yes, Javascript is the language of the web, and if you didn't notice, the web is anywhere.

i might be the most versatile language out there

Maybe

If you want to build user facing software, yes, if you want to build some autistic shitware in some esoteric language nobody uses, no.

no i am

If you learn JavaScript, do yourself a favor and also learn typescript

based trips

It's pretty incredible what js can do, but I think you should first have a good understanding of some core concepts of programming and code quality before you delve into the possibilities of bad style which js allows

user speak truth

Yes to both of these wise men.

>Backend? JS
>Front-end? JS
>Desktop multiplatform apps? JS
>Mobile apps? JS

This shit is fucking everywhere, even if you don't like it

>Electron

Learning it is worth it

Attached: 1543036581017.gif (364x339, 768K)

>before you delve into the possibilities of bad style which js allows
js forces you to use bad style, just look at callback hell and async/await

You forgot
>OS? JS

Get a linter like eslint with one of the presets too, makes keeping a good style so much easier

What is the problem with async/await? Promises are top comfy after taking a day to get used to them. Callback hell is terrible though, I agree.
t. Basically fulltime electron app dev

We have a JS based OS?

Yes Javascript or Python on top of what you are learning in class is GOAT

But if you started with Java in class, definitely learn a bit of C first (enough that you can understand K&R) and it will give you a better understanding of languages and Javasript in general.

No.
Learn Lua

>the web is anywhere.

Attached: 1535386043069.jpg (250x238, 7K)

>>async/await
>>bad style
nice LARP
name a better way to handle asynchronous program flow

Basically the only language you need outside of a few specialised fields and legacy support.

Yes.
node-os.com/

Yes, it's utility is pretty high. I've written backend services in Node.js, frontend with React/Angular, and utility with it. Promises are great to use, and wrangling multiple network requests has never been easier. In terms of time to implement it, it's incredibly fast.

by not using async program flow...

I think it's horrible personally:

1. no native int64's (makes it pain to interop with something like a c# datetime in nanosecond ticks)
2. no proper dictionary with ways to implement custom hashcodes or equality
3. no types
4. not only null, but also undefined
5. hard to serialize objects properly including their prototype chain
6. prototype's are very powerful but a) no one understands them so you can't use them as they should be b) give you too much power
7. no proper threads although it could be argued it's not as hard to shoot yourself in the foot.
8. bizarre type system - e.g. new String("sdf") is an Object type, not a String type.
9. everything is a double, so it's a pain to get int32's properly working.
10. no concept of structural equality (e.g. { foo : 3 } != { foo : 3}
11. working with bytes is a massive pain

but it's more important if you're learning to nail down the fundamentals (e.g. binary trees, scoping, sorting, pointers, types, threads). For this reason, I think Haskell and C are great starting languages, since if you master the topics in these, you can definitely understand most languages.

All these things do not prevent you from delivering robust software. Just don't use the broken parts of the lang.

considering you can (and should) code in it as if it were an ordinary compiled language i think it's absolutely fine. Learn a lower language first though

1. JS defaults numbers to their correct size, and the maximum size is 2^1024, which is way above int64
2. There is one and only way to implement any sort of key-value data type, and it is with the object literal (let obj = {})
3. no problem
4. this is quite useful to check if a value exists, because otherwise it would just throw an exception (say checking an array up until the end+1, other languages will give you an error since that value is out of the array's bounds)
5. You could create a custom function, a prototype, a class, or just put a function inside an object literal (literal implementation of methods)
6. Prototypes are rarely used
7. Google "JS Web Workers"
8. Everything in JS is an object, and presumably each object has a "type" property which can be accessed with the "typeof" keyword
9. repeat of #1
10. The equality operator in JS "===" (in case for objects) merely checks if the 2 objects refer to the same object, so 2 distinct objects would not be equal to one another, however in a case such as
let a = {foo: 5};
b = a;
a === b // TRUE

they're equal

11. There is no support for memory management in vanilla JS, but if you mean manipulating bytes, there are bitwise operators

It's a good language to learn for career and web stuff. Knowing it simply opens a lot of doors, and you can do anything with it.
It's like a swiss army knife, you'd feel a lot happier having one knowing you have a tool for absolutely any situation..It's not really a specialised tool, but it will do the job.

it's a bad language, but all the libraries, V8 and modern syntax sugar make it good enough.

1. JS has bigInt developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
2. Everyone uses lodash or ramda to solve problems like this
3. Typescript
4. Doesn't really matter, you'd never check if something doesn't exist, but if it does exist
5. Don't know why this is a problem personally, because I don't write OOP..Or prototypical fake OOP as JS would be
6. Not an argument
7. You can run node.js in cluster mode which is generally good enough for web applications
8 I don't know what you mean? JS is pretty simple in that everything is an object except primitives, but they get autoboxed which is kind of confusing
9. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array
10. Same point as 2, if you want to check the contents of 2 objects you have to do a deep compare
11. I'm sure there's a library for it

1. doubles lose their precision after 2^53, they start skipping numbers. You can't represent 64 bit integers using doubles. Do you know how doubles work?
2. yes, and i think that's a problem. What if you have a trades object and you want to implement equality on whether it's primary key is equal, and use it in a dictionary?
3. I think static types are incredibley useful for a large
4. ...
5. thingsl like the structured clone algorithm, an integral part of the language, don't copy over the prototype chian.
6. I like prototypes, and i think it's bad they aren't used
7. web workers are very different to threads - they can't share memory and it is very expensive to copy objects over (and again, they lose their prototypes since the structured clone algorithm doesn't maintain the prototype chain). Again, do you know/have you used them before?
8. everything in js in an object? "asdf" is a string, not an object. the object's type property is sort of their prototype
9. no you have to do weird things with bitshifting to get that to work
10. yes, but there is no way to do structural equality - e.g. c# and java have .equals which you can override.

problem is, if you're working in a large codebase, then people will abuse things.

>people will abuse things

I feel this. I'm a nazi with the code bases I own, but some other ones are literal ass garbage. Hell, even sometimes I don't know if I'm doing wrong - its nice working with a language or paradigm that prevents you from making mistakes.

1. BigInt is already in the specs, you have arbitrary precision integers now.
2. There are library solutions to this.
3. Just because JS is dynamic, doesn't mean it's untyped. It's called weak typing.
4. You can easily check for both with x == null (also the only use of == that is okay) but having 2 bottom values is kinda redundant, indeed.
5. You can solve this by writing your own serializer function. Or you can go look for an existign library solution.
6. a) everyone seriously dealing with JS has a perfect grasp of the concept b) not really, but even if they were, what's the reason?
7. Yes there are proper threads. You also have to remember that JS is an embeddable scripting language. If the implementing environment allows threading, JS will be able to do threading. and it just so happens that every relevant vendor allows for threading.
8. new is object creation in every language, while type prefix is coercion/casting in everyl anguage that allows for it. How is any of this new?
9. Bitwise operators force numbers into a (u)int32 range, or you can just use BigInts
10. Library solutions exist for this. Objects are reference types, not value types. Comparing references should NOT be concerned about value equality other than the reference itself.
11. Not really, just use an ArrayBuffer

1. bigints are different to int64's also that's only in firefox. Again, im sure there is a library to do this (at work we compile down to a Uint32 typed array with two fields and do some horrible hacks to simulate it) but I don't understand why you can't have an native int64 in a modern language, given that is a) really easy to implement b) very very performant c) very useful
2. fine but most language have things like proper dictionaries built in.
3. typescript isn't javascript tho. I agree typescript is better for this reason
4. I think null is bad in general (since it's not compiler checked, so checks get added everywhere)
5. fine but in a large codebase, people can do whatever they like.
6. it's a problem because people treat javascript objects like c++ or java objects, when in reality they are considerably different. Instead prototypes are just ignored.
7. again, clusters are different to threads. Also, having threads in UI is great so you can always make sure the main thread isn't blocking.
8. i think autoboxing is very confusing for newcomers.
9. there is more to bytes than an array.....
10. right but you don't always want to do a deep compare -> what if i have rows of trades which i want to compare but their primary key, rather than the whole object?

1. bigint is not a fucking int64 and it's not in internet explorer yet
2. okay, but most languages have proper dictionaries built in
3. sorry you are correct, i should have said staticall ytyped
4. okay, but now you need null checks everywhere. I really despise null.
5. you can't because things like structured clone ignore prototypes. E.g. if you using webworkers, then you have to do some very strange things to get this to work.
6. i think you have way to high an opinion of programmers :)
7. whatever - js in most implementations doesn't have threads in the same way c# has threads.
8. in c#, "asdf" is an object and can be compared with an object string with the value of "asdf", again this relates to equality
9. yeah they do, but that's not as good as going int pint = blah; then just having it work.
10. fine but javascript doesn't let me define custom value types, so this just means it can't compose values and give them equality.
11. again, there is more to bytes than an array. E.g. streams, copy a string in utf-8 to the stream, auto resizing of streams.

Yes.

>internet explorer
IE is not a browser or JS engine so who cares

use a more literate white man language like
typescript or better, reasonml or f#

>built on top of the linux kernel

what do you want to do? First language to learn is mostly dependent of what you wanna do.

Unironically check Reddit Jow Forumsprogramming wiki.

WHY ARE THEY USING JS FOR ANYTHING NOT WEB RELATED? STOP USING JS FOR EVERYTHING, IT IS NOT PYTHON!!!!1

Say hello to WASM.

>2. okay, but most languages have proper dictionaries built in
What does this mean? JS does have built-in dicts. If you want different dicts (why do you really?) you can use a custom implementation, it's exactly the same in any other language, except most languages don't even have a built-in dict implementation

All of your other points are bizarre nitpicks as well, they hardly make JS "horrible". If small details that don't cause issues in 99.9% of code were enough to make a language horrible, then every language ever would be horrible. JS does a good job at being a dynamically typed language that doesn't get in your way.

>custom value types
What?

JS is in fact the fastest scripting language of today. LuaJIT is slower, Python is slower, there is not scripting language as fast as JS.

thiss, i dont get all the python shills, shit syntax and slower than js

I love Node, I really do, but... No. No, please, not like this.

I've herd of Lua. what are the benefits compared to JS?

JS is a massive piece of shit.

Attached: 1543973084950.png (1080x724, 59K)

Attached: Dzhaba screebt.png (700x700, 880K)

fuck, its true. Whats going on here?

oh, its doing lexicographic sort

JS' default sort algorithm converts all array elements to a string before sorting based on ascii values, yeah. Weird pitfall, but you get used to it the first time you have it happen to yourself

It's the most inconsistent language I've ever seen. It's worse than English, in my opinion, but like English it's completely worth it to learn it.

It's actually fun to write stuff in it. Plus almost all the things you develop with it are visible to the eyes, so you get instant feedback which makes it a great starting language (although it will corrupt you with bad practices)

I see you are already traumatized...

Attached: d9d.jpg (756x528, 156K)

5 years of node do that to a man

>the web is anywhere.
so is late-stage terminal cancer

yes, JavaScript is the only language you need desu

>Is it a good language?
no, but it's everywhere already so you may as well learn it at least to a basic or intermediate level

javascript is the literal clown world language

people aren't going to call you faggot anymore, for starters

funny story op, there was this kid in our class in hs we used to bully because he said he has a diploma in js, shaved his brow to resemble the logo of twenty one pilots, dyed his hair from brown to blonde and acted like hes smarted than everyone else.
So yeah dont do it

oh yeah and his dream was to work in ubisoft.

Attached: tenor.gif (360x346, 170K)

Just learn Python and C++ and you will be covered. JS is just... BS.

> Is it a good language?
its a client-side GUI for website and web application and its horrible crap..
>I was wondering if javascript would be worth >learning
yes learn it.. everything coming from the web today, if you want to keep yourself updated you should know js,jq,angular... at least at a reasonable lvl...

I don't know what's the point of a language that only work with strings and needs coercion to give you bastardized integers

NaN isn't equal to itself as per IEEE-754 spec. It makes sense, because you can't tell what operation resulted in a NaN. If you want to compare things in a stricter manner than ===, you can use Object.is(), which says that NaN is equal to NaN.

everything is web related now, there is no escape

>It makes sense
almost nothing in JS makes sense. it's just a bunch of shit stacked on top of a rotten core.

Attached: 1547167948485.jpg (600x258, 13K)

Attached: 1533583840589.jpg (666x860, 79K)

is there actually a good reason it does this or is it just god awful design?
t. don't know anything about js

JS was created in few weeks. It was rished. Nothing was thought through. And there's a massive requirement from web browsers that you be backwards-compatible with all this crap. So there's really little chance that JS will ever get really good. ES6 is still built on top of all this mess.

Since you're going to be a web developer anyway with a CS degree you might as well get started early and learn JS.

The web is 100% text, it only makes sense that sort() sorts using lexicographical order. There would be no point in doing otherwise, because type coercion to number would just turn strings into NaN and that would be a bigger wtf

+ binary operator does addition only if both sides are either a number or boolean, for everything else it does string concatenation
>[] + []
an array's toString() method returns its elements stringified delimited by a comma, so an empty array turns into an empty string, 2 empty strings concat'ed equal an empty string
>[] + {}
same deal here, except an object's toString() returns [object X] where X is the toStringTag property of the given object, which is "Object" for a plain object, so out comes "" + "[object Object]" = "[object Object]"
>{} + []
the first curly pair is just an empty block statement followed by a unary plus operator operating on an empty array, array's toString() returns an empty string, that coerced to a number is 0
>{} + {}
empty block followed by a type coercion, "[object Object]" is not a number, so out comes NaN

So yes, basically crossboarding /v/tard nigger cattle know no better

Attached: unknown.png (837x235, 12K)

he says while posting a toy example on spyware10

Oh no, why didn't object plus array return something sensical, fuck this language :'(

It's a garbage language but you basically need to learn it nowadays

>Is javascript a good language to learn?
it's not even good.

wasm is not a js substitute

Yes. I’ll explain why.

1. You’ll most likely have to use it over the course of your journey as a CS student / Programmer.

2. If are working on any sort of Front End web development, JavaScript is the primary language you will be using. There are other front end scripting languages but these are not as universally used as JS.

3. It’s actually a decent language for projects. You can look into AWS hosting and follow some project tutorials. The benefit of this is when you are interviewing for internships you can showcase your side projects very easily.

like?

I'm getting different results.

Attached: what.png (323x267, 3K)

jsbin.com
I guess they all implement it differently because the standard makes it undefined.

Attached: 1528983764215.png (499x246, 8K)

Graduate software eng, I have literally never touched JS or webdev in my life.

You're right, it's better than Python.

If you want to do anything with the web, (aside from purely backend development, but even then there's node.js) then yes, you'll NEED to know JavaScript.

Plus, JS is awesome. I'm a front end web developer though so I'm biased here lol

Attached: 1491597436414.gif (400x400, 1021K)

Node.js

How retarded are you?
Serious question by the way

>the standard makes it undefined.
The standard strictly defines it. The difference is that some REPLs parse input as a statement by default, and others as expressions by default.

You're seeing a difference because {} + {} could be the addition of two objects, but it could also be an empty block followed by a unary plus operator followed by an empty object. Which one it is is defined by context, and REPLs aren't always able to provide that context.

If you do console.log({} + {}) you should get the same result anywhere because it forces the argument to be evaluated as an expression.

>some REPLs parse input as a statement by default, and others as expressions by default
what is the diff between a statement and an expression in JS? aren't they the same thing?

>what is the diff between a statement and an expression in JS?
Read sections 12 and 13 of ecma-262
>aren't they the same thing?
No. For example, an if statement is a statement, but a ternary expression is an expression.

God damn that's overly complicated. No other language is this messed up.