JavaScript

y so much hate Sup Forums??

Other urls found in this thread:

livescript.net/
en.wikipedia.org/wiki/LiveScript
github.com/gkz/LiveScript
purescript.org/
github.com/purescript/purescript
journal.stuffwithstuff.com/2010/10/21/the-language-i-wish-go-was/
twitter.com/NSFWRedditImage

no srsly. why does this meme continue? just because you can write bad js doesnt mean you have to write bad js. js stops being a shitty language when you stop being a shitty programmer imo.

It suffers from import disease.

Same could be said about any language. People on Sup Forums don't really program though. They just say they do.

It looks like C yet doesn't me write C-like code and the fact that there's no types means I have to constantly do stupid tricks like ~~num and +num | 0 just to force a number to stay a number and not accidentally get converted to a fucking string whenever I add 2 numbers together.

Sorry mate, but JS encourages shitty code through its shit object model. To keep a large js project with multiple developers in line would require literal police.

C/C++ let you write fucked up code to, but at least if your devs have brains they offer tools to keep things clean and organized.

I love js, nowadays it's a pretty good swiss knife IMO

There's big established communities building a strong code base every minute. Why not?

> looks like C
wut? when is the last time you looked at JS code user?

if you remove:

>date
>math.random
>delete
>object.assign
>array.splice
>array.sort
>regexp.exec
>assignment
>var
>let
>for

you are left with a beautiful, fully functional programming language. js can be a good language. you just have to decide to make it so.

dom sucks !== js sucks

also function and =>

>looks like C
Now I'm convinced that 90% of Sup Forums can't code.

Stallman told me it is non free and evil

How do I create arrays of an arbitrary type in javascript?

something like struct { char *s; int n; } arr[];

const arr = ["a", 'x', 5, true, {}, ["q", null], () => {}, void(0)];

Proprietary + forced into most major websites by the Jewish cabal

...because I heard someone else say it! If I repeat it, I will appear smart!

Oh my god this thread.. why god?!

JS is a kitchen-sink language. Yes it has functional features. Yes you can use it to write functional code if you are disciplined enough. But it also has traditional inheritance, classes, and stateful methods as part of the standard built-in objects.

It's almost like they designed the language as they went along. Oh wait, probably because they actually did.

JavaScript in itself is an open standard, and in fact the most popular implementations of JavaScript runtimes are truly free and open source as well (V8, SpiderMonkey)

Because it's a trainwreck. The designer fucked up. It's inconsistent and oftentimes doesn't behave how a reasonable programmer would expect. It's quirky in all the wrong ways.

this.clear();
this kills the runtime

js is ok. its the jquery that is cancer. jquery and php.

>giving websites the ability to execute arbitrary code

es6 is nice and versatile, fuck whatever Sup Forums says

Brainlets like this user can't handle it.

>accidentally get converted to a fucking string whenever I add 2 numbers together.

Retard.

Mostly because Sup Forums is content with being neets that can only write hello world in 20 different languages and not actually working to leave their parents house.

Yes it sucks compared to other languages but fuck I wanted a job and to get the fuck out of my parents house.

people hate what they don't understand

var timestamp = new Date() * 1;

js is based as f. just don't use the lame-o frameworks, they are cancer. learn the dom and for nodejs learn the standard library. it's the sharpest and my most versatile tool in my box probably.

this

I really enjoy writing unit/component tests for JS, super easy when you try to be disciplined and implement pure functions

Because Sup Forums mostly consists of to hentai jerking off weirdos who live in their parents basement.

1st party JS is fine on websites and I also enjoy writing vanilla JS. It's the incessant use of 3rd party JS that's often an issue.

These, but also the fact that JS tries automatic semicolon insertion.
I don't care too much but it leads to retarded bugs when working with others and implementing a parser for JS is kind of retarded.
Imagine you'd cross a street and suddenly a robot would appear and shave an iron tube up your dickhole, because you could be a moron who wanted to piss on the street.

We use JSLint, and enforce the proper semicolon insertion rule

But I agree, there are some weird design decisions

Has anyone tried LiveScript or PureScript? Apparently they're functional programming languages that compile to JavaScript.

LiveScript
livescript.net/
en.wikipedia.org/wiki/LiveScript
github.com/gkz/LiveScript

PureScript
purescript.org/
github.com/purescript/purescript

>Date.now()
you retard

JShint is pretty nice too.

because it's easier to say what you're against than say what you're for.

I've heard that too, only ever tried JSLint

We're all pretty new to JS in general but I'm finding it more fun to maintain a node.js microservice than maintain a Java monolith

That's pretty interesting, I'm a fan of the functional/stream libraries like Ramda/Highland but I don't feel like I utilise them as well as I could. I use some kind of hybrid style that is probably going to be a nightmare for anyone who looks at the code in the future

Same here

>JSLint
Wasn't that outdated and gives too many false positives, almost like PVS-Studio?
ESLint and JSHint fixed those problems, afaik.

I actually can't remember which one we use now, but will keep in mind thanks

JS is ugly. My eyes bleed when looking at it.

you poor thing

...

> compile to JavaScript

You are doing it wrong, idiot.

JUST

It used to be optional, but now it's required to browse the web. JavaScript was a mistake.

You don't understand JavaScript. Read a book.

actually it has prototype inheritance
cant comprehend its power.

...

That's pretty sweet

Not them, but what books would you recommend?

are you braindamaged?

>increment count everytime you call Article
>call Article twice
>count is now 2
>wtf js

>accidentally get converted to a fucking string whenever I add 2 numbers together
literally how

I wouldn't say it's the language itself, but more its hype and overuse everywhere for the past 3 years

What is the hype? I didn't get the memo.

What the fuck kind of fizzbuzz am i looking at

It's not Lua

wasm will kill js dead.

There's finally light at the end of the tunnel

There is none. It just "is". Like you could do web scriping in php or some other shit but javascript is just plain better and easier. You don't need to get hype about a cheeseburger.

Sure the same could be said, for example, of PHP.
But if you're a good PHP programmer it's still going to run slow as shit and have security issues because it's PHP.
There are some languages that are still worth shitting on even if they are "written well".

On the other have, if you write good JS, it's near-as-fast-as-makes-no-difference to native and is secure as long as you're using a secure VM like V8.

Those which think DOM == JS should be euthanized. They are too stupid to be allowed to possibly breed.

use immutables and/or write better code, retard.

It's not like it's actually hard to write good JS code like it is in some other languages that have this problem.
Some people are just so stupid that they are hopeless no matter what language they write in.

open-source != free

who are you responding to?

Oh boy, if you're coming from Java then try Go for your backend. It has the simplicity of Node with the performance and sanity of Java.

Because when you only have 2 GB of ram JS slows down your computer a ton.

C# is better

I like JavaScript, but gorillion frameworks ruined it.
Now if you know only JS you can't do anything, so you have to learn few frameworks and have 2 years experiance to get monkey job.

picking up react with redux or mobx shouldn't take more than a week unless you're retarded

Don't even try to pretend like web development hasn't always been like this. If you can't deal with learning new languages or frameworks you shouldn't be getting a salary. What did you think the learning just stopped after you graduated college?

I like JS despite all its flaws.

...

JS's prototype-based bag-of-properties objects are the very reason it's so useful as an extension language. Anything else and it'd have died out a long time ago.

average Sup Forums user

journal.stuffwithstuff.com/2010/10/21/the-language-i-wish-go-was/

get rekt

No hate. I love JS

And how to fall in love with js?
Tell me about it.

The syntax is pure cancer

Why? Genuinely curious.

There was some buzz about Go in the department because I think AWS Lambdas are supporting it soon

I have more experience in JS than I do Java now anyway


Confusing when you first see it but it makes sense really

The biggest issue with JS is:

Ridiculous redundancy. (like 20 quadrilllion different ways to do the same thing)
I lost count of how many fucking ways you can make functions. Don't get me fucking started on all the weird brace and bracket positioning for some methods of doing it. Holy fuck self-invocation.

Weird fucking inconsistent shit that is STILL around despite a lot of other things being fixed.
Input is a regular case of this.

The fact it has to work with the DOM.
The DOM is hands-down the worst thing in all of webdev. I'd take the SJW cunts over the DOM any day. Fuck.
It needs to be deleted from history and remade to not be a horrific shitshow.
DOM is high-overhead as FUCK.

The JS Scoping system is FUCKED.
Not even the fact that there is some weird issues with scoping that led to people wrapping their shit up in anonymous functions and such.
Oh no, not that at all. The fact that any reasonably deep layers of enclosures increases overhead CONSIDERABLY the more layers you get down the scope chain.
Shit like that is why jQuery and such were horribly slow years back. The only thing that changed was processors. Trust me, use a browser with jQuery on an old machine and NOT doing any DOM-shit. It's still slow.

Beyond that, JS is fine.
They need to completely rewrite the core of it though.
It needs to start off with them making a new fork of it that is 100% NOT backwards compatible.
Write a translator to convert shit to the new spec.
Test it on highly obfuscated code too, to make sure it can parse and understand the silly things that can be done to generate code.

Thank god

It is easy but is not much logical. Is an autistic language.

- the concept of 'truthy'
- contextual this
- global, mutable variables for es5 and earlier
- misunderstood prototypical inheritance and attempt at classical inheritance on top
- weakly typed
- messy and bloated ecosystem requirement for any serious project
- primarily targets the browser, needs to load whole script at once before execution starts
- need for tools such as webpack, babel, typescript which all need their own complex configuration to get running
- a shitload of bad practice and patterns left over the years

it's a mess that you can work with though, at least with the right configuration and discipline

I think things have changed a lot though.

Most of that isn't criticism of the language itself. It's the insane community.

Can one learn JavaScript as their first programming language without permanently gimping themselves?

Following up. Is there anything specific to avoid?

Avoid any memes around ES5, ES6, Typescript, Coffeescript, and any other bullshit that needs a transpiler just to fucking run in a browser. Stick with vanillia ES3.

This is bad advice. ES 3 has lots of things that were deprecated later. Design patterns have changed completely since ES3.

Even some parts of ES5 are deprecated. And ES6 brings significant changes that allow for more functional programming patterns.

You should learn basics from ES5 then move on to ES6.

Dynamic typing was a mistake.

it has C syntax you retarded mongol

>The JS Scoping system is FUCKED.
ES6 kind of fixes that

also nice lucky trips