[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

JavaScript

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 100
Thread images: 8

File: js.png (10KB, 1052x1052px) Image search: [Google]
js.png
10KB, 1052x1052px
y so much hate /g/??
>>
>>60951690
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.
>>
>>60951713
Same could be said about any language. People on /g/ 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.
>>
>>60951713
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?
>>
>>60951745
> looks like C
wut? when is the last time you looked at JS code anon?
>>
>>60951690
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.
>>
>>60951747
dom sucks !== js sucks
>>
>>60951797
also function and =>
>>
>>60951745
>looks like C
Now I'm convinced that 90% of /g/ can't code.
>>
>>60951690
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[];
>>
>>60951873
const arr = ["a", 'x', 5, true, {}, ["q", null], () => {}, void(0)];
>>
Proprietary + forced into most major websites by the Jewish cabal
>>
>>60951690
...because I heard someone else say it! If I repeat it, I will appear smart!
>>
Oh my god this thread.. why god?!
>>
>>60951797
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.
>>
>>60951871
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)
>>
>>60951713

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.
>>
>>60951690
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 /g/ says
>>
>>60951690

Brainlets like this anon >>60951747 can't handle it.
>>
>>60951745
>accidentally get converted to a fucking string whenever I add 2 numbers together.

Retard.
>>
>>60951690
Mostly because /g/ 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.
>>
>>60951690
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.
>>
>>60951871
this
>>
>>60951690
I really enjoy writing unit/component tests for JS, super easy when you try to be disciplined and implement pure functions
>>
File: 55710254.jpg (66KB, 492x611px) Image search: [Google]
55710254.jpg
66KB, 492x611px
>>60951690
Because /g/ 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.
>>
>>60951690
>>60951713
>>60951797
>>60955136
>>60955118
>>60955905
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.
>>
>>60956255
We use JSLint, and enforce the proper semicolon insertion rule
>>
>>60956255
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
http://livescript.net/
https://en.wikipedia.org/wiki/LiveScript
https://github.com/gkz/LiveScript

PureScript
http://www.purescript.org/
https://github.com/purescript/purescript
>>
>>60955175
>Date.now()
you retard
>>
>>60956271
JShint is pretty nice too.
>>
>>60951690
because it's easier to say what you're against than say what you're for.
>>
>>60956321
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

>>60956290
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
>>
>>60956271
Same here
>>
>>60956271
>JSLint
Wasn't that outdated and gives too many false positives, almost like PVS-Studio?
ESLint and JSHint fixed those problems, afaik.
>>
>>60957016
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.
>>
>>60957150
you poor thing
>>
File: 14912462876870.jpg (29KB, 453x312px) Image search: [Google]
14912462876870.jpg
29KB, 453x312px
>>60951690
>>
File: v34C5o2ZQGw.jpg (16KB, 286x300px) Image search: [Google]
v34C5o2ZQGw.jpg
16KB, 286x300px
>>60956290
> compile to JavaScript
>>
>>60957418
You are doing it wrong, idiot.
>>
>>60957418
JUST
>>
>>60951690
It used to be optional, but now it's required to browse the web. JavaScript was a mistake.
>>
>>60957418
You don't understand JavaScript. Read a book.
>>
>>60953018
actually it has prototype inheritance
>>60951690
cant comprehend its power.
>>
File: no semicolons.png (19KB, 403x347px) Image search: [Google]
no semicolons.png
19KB, 403x347px
>>
>>60957966
That's pretty sweet
>>
>>60957898
Not them, but what books would you recommend?
>>
>>60951745
are you braindamaged?
>>
>>60957418
>increment count everytime you call Article
>call Article twice
>count is now 2
>wtf js
>>
>>60951745
>accidentally get converted to a fucking string whenever I add 2 numbers together
literally how
>>
>>60951690
I wouldn't say it's the language itself, but more its hype and overuse everywhere for the past 3 years
>>
>>60959172
What is the hype? I didn't get the memo.
>>
>>60957966
What the fuck kind of fizzbuzz am i looking at
>>
>>60951690
It's not Lua
>>
wasm will kill js dead.

There's finally light at the end of the tunnel
>>
>>60959320
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.
>>
>>60951742
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.

>>60951747
Those which think DOM == JS should be euthanized. They are too stupid to be allowed to possibly breed.
>>
>>60951745
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.
>>
>>60953041
open-source != free
>>
>>60960085
who are you responding to?
>>
>>60956368
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.
>>
>>60951690
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.
>>
>>60960456
picking up react with redux or mobx shouldn't take more than a week unless you're retarded
>>
>>60960456
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.
>>
File: 1497804741054.jpg (264KB, 543x576px) Image search: [Google]
1497804741054.jpg
264KB, 543x576px
>>60957767
>>60957851
>>60957898
>>
>>60951747
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.
>>
>>60951745
average /g/ user
>>
>>60960141

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

get rekt
>>
>>60951690
No hate. I love JS
>>
>>60960698
And how to fall in love with js?
Tell me about it.
>>
The syntax is pure cancer
>>
>>60960698
Why? Genuinely curious.
>>
>>60960141
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


>>60961070
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.
>>
>>60959944
Thank god
>>
>>60951690
It is easy but is not much logical. Is an autistic language.
>>
>>60951690
- 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
>>
>>60965358
I think things have changed a lot though.
>>
>>60965358
Most of that isn't criticism of the language itself. It's the insane community.
>>
File: inline_njg3hlkf161t4c9lt.jpg (111KB, 500x375px) Image search: [Google]
inline_njg3hlkf161t4c9lt.jpg
111KB, 500x375px
Can one learn JavaScript as their first programming language without permanently gimping themselves?
>>
>>60967110
Following up. Is there anything specific to avoid?
>>
>>60967944
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.
>>
>>60967975
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.
>>
>>60951745
Dynamic typing was a mistake.
>>
>>60951846

it has C syntax you retarded mongol
>>
>>60963777
>The JS Scoping system is FUCKED.
ES6 kind of fixes that

also nice lucky trips
Thread posts: 100
Thread images: 8


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.