[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: 170
Thread images: 11

Why do people (read: women and nu-males) love this utter shit language so much?
>>
The same reason why neckbeards love C.
It's the first language they learn and they think they have the right to write everything in that language because they know it top to bottom.
>>
>>56194869
b-b-but you're a WHITE MALE!!!
>>
>>56194829
Because it's super common. Popularity spreads, bro.

I plan on learning Dart, apparently it is a good alternative?
>>
>>56194829
Its the best scripting language, I like Ruby and Python but both Ruby and Python would make for a shitty browser language compared to Javascripts prototype OO. People who hate JS are just tards who cant program and cant give any reason for why its bad. PHP is bad, PHP has been replaced by Ruby and Python for backend web programming. You cant replace JS, its been tried, none of the replacements are as good.
>>
>>56194962
My Wordbress site runs on Bython now? :DDdddd
>>
>>56194925
Dart is used nowhere and I'm pretty sure even Google is dropping it so there's no point in using it. Learn Typescript instead if you want something a bit more comfy that regular JS.
>>
File: lJl7ib7.jpg (70KB, 702x1024px) Image search: [Google]
lJl7ib7.jpg
70KB, 702x1024px
>>56194829

You can use it to make websites (in the browser and on the server), desktop apps, mobile apps, video games, and with embedded/IoT devices.

It's not "utter shit" because you suck dick at it m8
>>
>>56194829
Why do neckbeards on /g/ love C so much if the only thing they can program in it is a FizzBuzz?
>>
>>56194962
>php
You realize only node.js is server side, right? Javascript otherwise runs client side which is a huge security issue. Technically asp is far superior since it does both.

Also don't confuse system scripting language with Web scripting language.
>>
>>56195004
Google is using Dart+Angular 2 a lot recently.
>>
>>56194829
It earns me £50k a year making PWAs for clients. Feels pretty comfy
>>
>>56194962
>Ruby
No, ruby is a meme.
>Python
Idiots using a system scripting language for Web. Why not just run a Web server in bash?
>>
>>56195079
What's your point?
>>
>>56195079
>You realize only node.js is server side, right?
Im saying that neither Ruby or Python would make a good client side language to embed in the browser

>Javascript otherwise runs client side which is a huge security issue.
These security issues are unavoidable on the client weather it be Flash, Java applets, whatever

>Technically asp is far superior since it does both.
lol, MS's answer to applets, wow I see where this is going

>Also don't confuse system scripting language with Web scripting language.
why dont you explain to me the difference, there isnt any but I like to see how retards make shit like this up
>>
>>56195079
He didn't, m8. He was comparing as if they were.
>>
>>56195004
Isnt typescript just a layer over javascript? Seems to ruin the point of learning a different language. I guess it's worth a shot since JS isn't leaving.
>>
>>56195169
>difference
Python requires additional modules to work with Web, Javascript was designed explicitly for Web. You can write a user mode driver in python, doing so in Javascript would be beyond retarded.

>unavoidable security issues
That's why you run server side, which until node was impossible in Javascript (hence php)
>>
>>56194911
Fucking WHITE MALE, please.
>>
>>56195222
Why would writing a driver in Javascript be any more retarded than writing a driver in Python?
>>
>>56195275
Javascript requires Web components to process the language. You now have tons of overhead for a simple task.
>>
>>56195327
Are you retarded?
>>
File: the_social_network15[1].jpg (123KB, 1250x841px) Image search: [Google]
the_social_network15[1].jpg
123KB, 1250x841px
>nu-males
What exactly about programming made anyone a masculine specimen?
>>
>>56195327
Javascript compilers purposely leave out I/O functionality to make it a more secure language in the browser. There is absolutely nothing about the Javascript language itself that would prevent its use in making drivers compared to Python
>>
>>56195339
Are you? It's pretty clear by this point that you're a Web developer and haven't worked beyond.
>>
>>56195357
It's just a codeword for "people I don't like".
>>
>>56194829
It can be fun to program in because of the fast feedback loop (partly due to it being used for web programming, partly due to it being dynamically typed).

It has warts but these aren't as significant as the warts of many other languages. Most of the risks you face can be mitigated through JSHint and thinking about what you're doing.
>>
File: john.jpg (42KB, 474x474px) Image search: [Google]
john.jpg
42KB, 474x474px
>>56194829
Nobody who works with JavaScript loves it. We use it because we have to. We use jquery for convenience. Thank you based John Resig.
>>
>>56194829
Because you can write and run programs that will run on literally every single computer out there.
>>
>>56195371
It's clear that you have no fucking idea how programs are even run.
>>
Because no one has made a better universal client-side web scripting language.

Get to work, OP. You could be the savior. But no, you'd rather just bitch and complain.

Typical.
>>
>>56195366
Python includes io components. That's part of the reason many people use it for embedded prototyping.
>>
>>56195423
And so does node.
>>
>>56195394
>thinks system components can be built in Javascript
This is why I hate dealing with Web developers. You have no fucking clue what goes on under the Web server.
>>
>>56195447
>thinks system components can be built in Python
>>
>>56195440
Wow, people actually built that. I'm appalled. Shit, let's just build a flash-based embedded board, good idea right?
>>
>>56195488
You still haven't given a reason why Python is any better.
>>
>>56195467
>doesn't realize some have been
https://github.com/chrippa/ds4drv
>>
>>56195388
>Can do this in Java
>Can do this in HTML5
What programs are you referring to? If you're talking about ones with a browser interface, there are tons of other options.
>>
>>56195509
Python: Better for lower-level stuff
Javascript: Better for Web development

I never said one was better than the other in all aspects.
>>
>>56195570
Both are awful for lower-level stuff.
>>
>>56195579
Chef works pretty well, and deals exclusively with Python.
>>
>>56195511
https://github.com/rdepena/node-dualshock-controller
>>
>>56195605
>Chef
>low level
>>
>>56195387
So the guy who made JavaScript indeed is the ass Mozilla SJWs painted him to be (if for reasons entirely different)?
>>
>>56195627
After looking at benchmarks node does come out in many cases. Javascript drivers are just as much of an abomination as Python drivers. Python isn't a web language, I don't understand why people insist on making it one. Javascript is capable of doing the same things, sure, but for managing thousands of systems, python is and always will be the goto.

With that stated, I think the biggest problem I have with javascript is the pathetically low barrier for entry. Given that it's sufficiently fast if coded CORRECTLY it can be used for many things. Due to the barrier being so low we have 2 billion fuckwits who couldn't code a hello world application in less than 10 lines and 5 people who are actually capable developers.
>>
>>56195736
Please tell me what advantages Python has over Javascript that makes it the goto for managing thousands of systems.
>>
>>56195755
Node is asynchronous. If you run a series of system management commands out of order (as is guaranteed in javascript) you can seriously fuck things up.
>>
>>56195814
>what are promises
>>
>>56195825
>What is working around a programming language to make it do something it wasn't designed for?
>>
>>56195871
>wahh wahh I don't know how to use async
You know there are synchronous versions of pretty much everything in node right? The reason why no one uses them is because blocking the entire thread while waiting for an IO event completely destroys performance.
>>
>>56195914
You realize that's not a problem in Python right?
>>
>>56194869
I learnt Basic first and now I'm a #C++ missile
doest that make me alpha?
>>
>>56195943
It's not a problem in node either when you use the synchronous versions, but that's fucking retarded.
>>
>>56195961
>but that's fucking retarded.
And why you don't use node over Python for system management.
>>
>>56195605
>>56195570
I like Python and all, but you're a retard for thinking it's low level
>>
>>56196017
Holy shit you are fucking retarded.
Do you even know why asynchronous programming exists?
Let's say you need to send a command to configure 1000 machines. Each one takes 20 minutes to do. Are you going to send the command to the first one, wait 20 minutes for it to complete, then send a command to the second one, then wait 20 minutes for it to complete, and so on? Because that's what will happen if you try to program synchronously.
>>
>>56196063
>Doesn't understand system management
Ok, here we go:
In Python you send out the same script to thousands of servers. It runs on all server simultaneously for 20 minutes.

In node it runs all out of order unless you programmed around that problem or you used the synchronous version.

Not hard buddy. The cube fits in the square hole.
>>
JavaScript is the worst piece of shit ever designed (or should I say: thrown together by fucking Eich in literally 10 days).

Fuck consistency and transivity:

'' == '0' // false
0 == '' // true
0 == '0' // true

false == 'false' // false
false == '0' // true

false == undefined // false
false == null // false

null == undefined // true
'\t\r\n' == 0 // true


Fuck sanity:

typeof null == 'object'; // true
typeof NaN == 'number'; // true
NaN == NaN // false


Here's a great idea: automatic semicolon insertion!

// guess what this function returns, I dare you:
function f() {
return
{
foo: 'bar'
};
}


If that didn't blow your mind, how about this:

(Number.MAX_VALUE + 999) == Number.MAX_VALUE; // true
(Number.MAX_VALUE * 1.1) == Number.MAX_VALUE; // false, Infinity


Speaking of numbers, all numbers are 64-bit, except if you plan to do any bitwise operation at all, in which case they're silently converted to 32 bits, than back to 64 again:

Math.pow(2,31) == 2147483648 // true, as expected
1 << 31 == -2147483648 // also true, because fuck you


There are dozens if not hundreds of warts like this waiting to blow up in your fucking face at runtime. Noone in their right mind would choose to use JS for anything more than animating fucking snowflakes on a webpage.
>>
>>56196017
Because node is pajeet tier javascript piece of crap. JS is a shit language which is massively overused. Never use node for anything. Ever/
>>
>>56195028
>the interpreter is the language

Okay. That makes perfect sense.
>>
>>56196131
>In Python you send out the same script to thousands of servers. It runs on all server simultaneously for 20 minutes.
Ok, and how do you know when all those servers have finished so you can send the next script?
>>
>>56194829

Common, easy to use, useful.
>>
>>56196136
>not using ===

You don't even understand the language. Kys.
>>
>>56196155
>Send the next script
The point is you don't need to send another script. You're not consuming resources on the sending server and it's all done on each server around the same time. If you need to you can implement logging for later review.
>>
>>56196185
And how do you get the information so that you can write the logs? How can you know that the script succeeded? What if it failed? Do you just leave the machine there doing nothing?
>>
>>56196216
Not him but how would you do it with node?
In any case you will need a response.
>>
>>56196216
>How can you know that the script succeeded? What if it failed?
If you wanted it to report back you write to a database hosted on the sending server. Alternatively you can have each server log to itself and parse them centrally (by collection).
>>
>>56196280
To add:
Putting them in a database makes them universally accessible. If you wanted to parse them using anything else it's easy.
>>
>>56196280
Ok, and how do you collect them? Are you going to send a request for the first one's result, wait for it to come back, then send a request for the second one's result, then wait for it to come back, then send a request for the third one's result, then wait for it to come back, for all 1000 of them?
>>
>>56196301
>send a request
Stop thinking in Javascript. You have the ability to load anything you need to from the client to the server at any point throughout the script.
If you chose to parse by collection you would copy the log file back (invoking scp or similar).
>>
because no hard typing and they just have to make a collage of other people's work
>>
>>56196339
But your function that sent the scripts already executed and returned. How are you going to check when the logs are ready?
>>
>>56195661
He's not an ass, he was just the guy who had to invent a language under a week to do stuff like showing an alert box or change some text. JavaScript was not designed for the shit retards wanted it to do. It should've been replaced the moment people wanted to do more than simple document tricks.
>>
ITT: Nerds arguing about shit that companies have pretty much already solved.

Use the best language for the job you fucking retards. Knowing one language (or in JS's case 4 fucking supersets of itself) is a quick ride to becoming useless.
>>
>>56194829
because reality has such a bizarre bias for irony that SJWs slobber all over a language thrown together by a homophobe.
>>
>>56196388
They have either populated the database or (if you chose to collect) are files local. You can write whatever application you want to parse the database and monitor hosts. If it exists in the database, it succeeded. If not, it failed. If it has an error, fix it (you should have written the script to give you sufficient information).
>>
>>56196166
[] === [] //false
>>
>>56196419
So an EVENT LOOP? Like what Javascript has?
>>
Why couldn't we have had Scheme in the browser?
>>
File: abtgyr.png (26KB, 989x226px) Image search: [Google]
abtgyr.png
26KB, 989x226px
>>56196443
>>
>>56196136
>using == and not ===
>permisive typing is what allows JS to let retard programmers make stuff that 'just werks' so they dont have to sift through non-important type errors
>>
>>56196450
In the sense that you're part of the loop? I guess. Javascript would require having an application running during the whole process, wasting resources on every server. Node has to be run as a daemon whereas Python does not. To monitor, you monitor the database. This leaves you with fewest resources used and lowest bandwidth utilization.
>>
>>56196400
>It should've been replaced the moment people wanted to do more than simple document tricks.
people keep saying this and yet no one can give an example of a language that JS should be replaced with because there is none, this is just mouth-foaming basement dwellers who have never done anything beyond C
>>
>>56196517
That's because "is" checks to see whether or not its the same fucking object, not value equality
>>
>>56196600
As a front end or back end? Java is superior as a back end. HTML5 is a better option for front end.
>>
>>56196574
How are you monitoring the database? With a fucking cron job? What if your configuration server needs to do something after all the machines are ready? Are you going to restart Python and your script every fucking second to check whether it's ready?
>>
>>56196622
>HTML5 is a better option for front end.
oh the lulz
>>
>>56196614
Python 2.7.12 (default, Jul 18 2016, 15:02:52) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 5 is 5
True
>>>
>>
>>56196628
>What if your configuration server needs to do something after all the machines are ready?
Still not getting how batch management works. If something needed to be done, it's included in the original script.You never need to send additional commands.

>Are you going to restart Python and your script every fucking second to check whether it's ready?
If you write the script in Python you can include a loop to monitor (the server sending the scripts out would have a different script entirely).
>>
>>56196628
Have you ever fucking heard to RSYSLOG or FUCKING SYSLOG or ANY OTHER log centralization system made in the last fucking 5 years?
>>
>>56196136
>Speaking of numbers, all numbers are 64-bit, except if you plan to do any bitwise operation at all, in which case they're silently converted to 32 bits, than back to 64 again:
what the fuck why would they do this?
>>
>>56196673
And what if a machine fails and you need to allocate more resources to make up for that failure.
>>
>>56196552
>>56196166
Yes, you faggots, I'm using == instead of === to make a point about lack of transivity and consistency in automatic type conversions.

>>56196517
Yes, [] is [] returns False in Python, because those are two different instances. [] == [] returns True as it should. In JS both === and == return false which is retarded.

>>56196642
CPython's implementation keeps an array of all integers between -5 and 256 so that when you create an int in that range, you get a reference to a pre-existing object. Yes, it's retarded too.
>>
>>56196151
>I don't understand it therefore it sucks

Its ok there are plenty of other languages that are a good fit for your skill level
>>
>>56196628
Why are having such issues understanding how modern config management and deploy systems work?
>>
>>56196726
Python 2.7.12 (default, Jul 18 2016, 15:02:52) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 1000 is 1000
True
>>
File: Neonlaffs.jpg (36KB, 1560x658px) Image search: [Google]
Neonlaffs.jpg
36KB, 1560x658px
>>56196642
>>
>>56196755
Why are you having such issues understanding how asynchronous programming works?
>>
>>56196726
>>56196759

You have been exposed, please retire from programming for your own sake
>>
>>56194829
>nu-males
Get back to your containment board, /pol/.
>>
>>56196715
>allocate more resources to make up for that failure.
What in the fuck are you talking about!? THIS IS NOT JAVASCRIPT. YOU DO NOT ALLOCATE MORE RESOURCES.
God damn, are all web devs this fucking thick?!

If one fails you check why it failed. You fix it.
If you had the ability to build self-healing systems you wouldn't be programming in a fucking scripting language.
>>
>>56196966
>send request to machine to execute script
>network is down on the machine's side
>HURR DURR JUST CHECK WHY IT FAILED AND FIX IT
>>
>>56194962
>People who hate JS are just tards who cant program and cant give any reason for why its bad.
The core language lacks too much functionality. In python, ruby, etc you have tons of functionality in the standard library. In Javascript you basically need to rely on a framework, but the problem is the lack of standardization which causes the "meme framework" thing you probably heard about, where every year a new framework gets relevant and you have to re learn everything.
Javascript is also terrible with its typing. It's not statically typed like C or Java, but unlike python the type casting doesn't make any damn sense. I saw a thread here the other day where someone wrote something like 10 == [!+![]]+[+[]] and it returned true. This wouldn't happen in python
>PHP is bad
Care to explain why php is bad but Javascript isn't?
>You cant replace JS, its been tried, none of the replacements are as good.
There is a difference between server side and client side scripting.
You can replace php in your back end with python, and ideally nothing would change for the end user. In fact, each http server in the world can use any language they want. They could use assembly if they wanted.
Client side scripting, however, requires the END USER to have the programming environment installed on his computer/phone. It's normally embedded in the web browser for simplicity.
Now if Google Chrome said they remove Javascript from their Web browser and instead put python in it, people wouldn't be happy. Web site owners now to have to provide a Javascript AND a python version for their website, because they don't know if the user will use chrome or not. And the end user will inevitably run into issues when he goes to a website that doesn't have both implementations.
>>
>>56196997
>send request to machine
You really have no concept of this...

There is no "send request". You can put conditions into the script i.e. ping it first. You do not need to maintain a connection, that's a pajeet-level waste of resources. You do not need to have active monitoring of every client, that's a pajeet-level waste of resources.

Here I was thinking the problem with modern application design was Indians, clearly it's coming from the fucking inside as well.
>>
>>56195108
>Why not just run a Web server in bash?
PFFFFFFFFT
>unironically wanting to use a language with that massive load of vulns around every corner
Nearly as stupid of an idea as using perl.

Just wait until a user types !penis into a GET request and you try to echo it to the console like the stupid bash monkey you are. Bash is the reason the 30 different shellshock vulns were a thing.

Daily reminder that 2017 is going to be the year of DeviousYarn.
>>
>>56196740
>>the language sucks
>BUT IT WORKS EVERYWHERE!!!!!!11
>>
>>56197050
>ping it first
So send a request?
>>
>>56197052
>Just wait until a user types !penis into a GET request and you try to echo it to the console like the stupid bash monkey you are. Bash is the reason the 30 different shellshock vulns were a thing.
Read some of the earlier bits. Running a webserver in bash is a painfully stupid idea.
>>
>>56195079
>Javascript otherwise runs client side which is a huge security issue.
Such as? SOP exists, and javascript is sandboxed well enough so that it can't do much of anything unless you run it on a broken browser.
>>
>>56197006
Youre not a web programmer, youre trying to use the arguement that JS should be more like Java and have a built-in ecosystem of functionality, that is stupid. The compiler implementers purposely left out any platform level functionality because it is a huge security risk. Only when you are using JS for backend programming is it ok to add that functionality like node does.

>Care to explain why php is bad but Javascript isn't?
PHP is an obsolete language, it started out as a bunch of Perl scripts that got converted into a standalone language. Its OO was added after the language was first designed and is basically Java-style OO bolted on. It simply lacks the everything-is-an-object design that both Python and Ruby were designed with from the get go. PHP syntax itself is really shitty, using a period for string concat, using the arrrow (->) for method calls. The PHP API is an absolute joke of inconsistent methods added haphazardly
>>
>>56197057
>refers to any operation as request
Ok, yes, send an ICMP request, something that requires near nothing resources. Logically it's the same operation.

Javascript ping (after downloading/importing the necessary library):
var session = ping.createSession ();

session.pingHost (target, function (error, target) {
if (error)
console.log (target + ": " + error.toString ());
else
console.log (target + ": Alive");
});

Python ping:
import os
response = os.system("ping -c 1 " + hostname)
if response != 0:
<do something on failure>
>>
>>56195570
>Python: Better for lower-level stuff
Python is great but that's the most hilarious shit I've ever heard in my life.
>>
>"the good parts"
it's just an empty book
>>
>>56197144
Technically the Python option can be shortened even further:

import os
if (os.system("ping -c 1" + hostname) != 0):
<do something>
>>
File: 1465831684865.jpg (7KB, 300x294px) Image search: [Google]
1465831684865.jpg
7KB, 300x294px
>>56197144
>os.system
>>
>>56197132
Lately, I get many links when googling "javascript wtf".
Perhaps, Javascript sucks just like PHP, even requiring the help of big companies to coordinate patches and upgrades like ES6.
>>
>>56197195
https://docs.python.org/2/library/os.html
>>
>>56196136
automatic typecasting was a mistake, but use ===
'' === '0' // false
0 === '' // false
0 === '0' // false

false === 'false' // false
false === '0' // false

false === undefined // false (false is not undefined)
false === null // false (false is a value, thus not null)

null === undefined // false
'\t\r\n' == 0 // false

This is actually described by IEEE floating point specification
NaN == NaN // false. Any comparison with NaN is always false, even with itself


// guess what this function returns, I dare you:

I don't understand this. It returns exactly what it should return. That's the format of a JSON object. It returns a JSON object. I double checked but yeah, that's exactly it.

(Number.MAX_VALUE + 999) //is 1.7976931348623157e+308. As per floating points, any significant figures under 10^290 are ignored. Try adding 1e+300 and it'll be infinity
(Number.MAX_VALUE * 1.1) == Number.MAX_VALUE; // false, correctly, because it's adding a significant number. Being 1.7976931348623158e+307


The last one is pretty shit though. I agree.
>>
>>56197196
It tends to be a pain in the ass.
>>
>>56196136
Auto semicolon insert is...eh.

You really have to be writing code in a retarded way possible for it to cause an issue.

>>56197237
But otherwise the fact that you can't figure out whats going on in that 3rd example does not bode well for your JS skills
>>
>>56197144
>os.system
>I'm retarded and don't know how to use node the way I want to therefore JS is bad
const cp = require('child_process');
response = cp.spawnSync('ping, ['-c', '1', hostname], {encoding: 'utf-8'}).stdout;
if (stdout != 0) { doSomething(); }
>>
>>56197351
>require('child_process');

>Doesn't understand the purpose of async vs sync programming
Ok, so your server is still running, still wasting resources. Great job. You're fired.
>>
>>56197372
How is this any different than your Python program?
>>
>>56196136
'' == '0' // Using == for strings, so they're different.
0 == '' // Using == for ints, so the '' is converted to an int.
0 == '0' // Using == for ints, so the '0' is converted to an int.

false == 'false' // Using == for booleans, so the 'false' is converted to a boolean (true, because it's not an empty string)
false == '0' // Using == for booleans, so the 0 is converted to a boolean (false)

false == undefined // It isn't undefined. Big surprise!
false == null // It isn't null either. What is the issue here?

null == undefined // Are you taking issue with the last two? If x != 3 and y != 3, then 3 still equals 3.
'\t \r \n' == 0 // Slightly weird behavior, but a string containing only whitespace is equal to both 0 and false.

Yeah, types are weird, but JS converts them automatically. I'd prefer an error because muh strong typing etc etc, but that just invalidates code. It's not like JS lacks a feature. My code is going to work the same either way, so it doesn't effect me.

(Number.MAX_VALUE + 999) == Number.MAX_VALUE; // true
(Number.MAX_VALUE * 1.1) == Number.MAX_VALUE; // false, Infinity

Yeah, bigints are a thing that has to be dealt with. + and * do different things, just more different than usual in JS. Learn how types work please.

The one about the function returning undefined was kind of funny, but that's what you get for having a hilariously shit indentation style meant to intentionally obfuscate code and get you more pajeet points for increasing your LOC. Nothing wrong with a whitespace sensitive language.
>>
>>56194829
Cancer is delicious.

It spreads everywhere so you never have to question your limits as anything besides a matter of time.
>>
>>56197380
The Python script runs once. No daemon, no other processes. You still have your Node daemon running. Not to mention once you're past this point you're integrating your code into a monolithic program that HAS to be running constantly to be of any use. If it fails, you're fucked. If the Python program fails, you're left with logs.
>>
>>56197440
>node has no logging system
You obviously have no idea how node works. You're embarrassing yourself. node is an interpreter just like CPython and exits when a script finishes.
>>
>>56197435
alf (dot) nu (slash) ReturnTrue

Riveting.
>>
>>56194925
It also gets you employed. Being a fullstack developer requires knowing JS.
>>
File: 1451819036784.png (836KB, 987x498px) Image search: [Google]
1451819036784.png
836KB, 987x498px
I do full stack development, at my place developers are expected to wear every hat, so I do a fair bit of JS. Hated the language at first but after a while the strengths grow on you. First-class functions and anonymous functions are great. Prototypes are great. You have to be careful, but the language is incredibly fluid. Throw in jQuery and underscore (or their alternatives) and you can make fairly complex functions very terse and clean.

That said I still don't like some of the decisions they made in regard to typing.

Another headache which I don't see mentioned very much deals with the way strings are handled. E.g. I had a system that had to accept all manner of characters for certain fields (provided by the user) and use them later. Characters like ', ", \, etc. It was an unchangeable business rule carried over from legacy. These present no problems at all on the back-end but using them in JS presented a mild headache, all sorts of escaping or encoding necessary to avoid problems which, while not difficult, just seems silly in retrospect.
>>
>>56197484
>exits when a script finishes.
No, you still have to have your daemon running to process the rest of your script. In Python you have sent the scripts to the servers and can exit. If you choose to program your node script to do the exact same thing as the Python script you have to download a bunch of libraries just to make it work. This stuff is built into Python.
>>
>>56197533
child_process is a library built into node you fucking retard.
>>
>>56194962
>I like Ruby and Python
>Python
Must be cool being 14
>>
>>56197517
Scheme would be a lot nicer.

JavaScript's scoping drives me up the wall.
>>
>>56197560
>what are let and arrow functions
>>
>>56194829
You just learned how to print hello world, didn't you?

Back to your safe space >>>/pol/
>>
File: CqEmzsRXEAAcSI8.jpg (138KB, 914x1200px) Image search: [Google]
CqEmzsRXEAAcSI8.jpg
138KB, 914x1200px
>>56197560
scoping is getting fixed soon(tm)
Also, for all the javascript bois, use arrow functions, they are supported everywhere now
>>
>>56197543
Ok. Still running an asynchronous language to do synchronous tasks, Pajeet.
>>
>>56197577
How is it an asynchronous language? Every asynchronous action has a synchronous equivalent.
>>
>>56197589
Node is in nature an asynchronous language. You have to program around the fact that it is asynchronous. You said yourself that you would have to install the synchronous version to get around this.
>>
>>56195509
Python has NumPy, which removes 99% of the need for the performance of a lower level language.
>>
>>56197610
You literally do not know what you're talking about. You have to be 18 to post here.
>>
>>56197544
>trying to shoot down Python and Ruby
>basement dweller level of programming knowledge
>>
>>56197610
>install
It is built into node. Do you have to "install" os.system in Python too? Oh look! Python has some async IO librarys too!

https://docs.python.org/3/library/asyncio-dev.html

I guess it's now useless.
>>
>>56195814
You know that Python literally has an async keyword now?
>>
>>56197629
>Defends having to program around a language's design
Alright kid, have fun with that.

>>56197639
>Python has some async IO librarys too!
OH GEE! THANKS FUCKWIT!
No shit it has asynchronous libraries, it's synchronous by default. No additional methods/functions/imports required.
>>
File: 1417567490721.png (360KB, 538x477px) Image search: [Google]
1417567490721.png
360KB, 538x477px
>mfw I use javascript for prototyping control systems and algo research
Come at me certified fizzbuzz engineers :^)
>>
>>56197662
No, you're literally spouting nonsense. The language is completely synchronous until you choose to dispatch a callback.
>>
>>56197662
You had to import os.system though.
>>
>>56196517
At least Python's == works.
>>
>>56194829
In this thread: butthurt Javascript plebs
>>
>>56197327
>uh..you don't understand Javascript bro!
jimmes = rustled
ass = blasted
>>
>>56196600
Lua, Lisp, Ruby.

Literally any interpreted language could work as a scripting language. Once we get Web Assembly you can bet your dragon dildo that there will be Python to Web Assembly compilers.
>>
>>56197327
>But otherwise the fact that you can't figure out whats going on in that 3rd example does not bode well for your JS skills

It returns a JS object, built in the form of a JSON tree.
What the fuck are you talking about I can't figure out what's going on.
>>
>>56197679
>Says language is synchronous
>Actually doing anything in language is asynchronous
Have you ever actually used Javascript server-side?
>>
>>56197776
Yes, but apparently you haven't. There's no asynchronocity if you don't dispatch anything to the event loop. Then it's no different than writing a linear python script.
>>
web development is hell, just get a comfy non-web dev job and you dont have to deal with these crap technologies.
>>
>>56194829
Because flash dies and we dont have any other language for client side browsers.
>>
>>56197754
>Lua
is a cheap version of Javascript, using tables for OO is painful and hacky

>Lisp
this is insane, homoiconicity in a web API could never work, transpiled abstractions like clojurescript are just that, abstractions and could never work for the base API

>Ruby
This would require you to worry about class types, Javascript's strength is that you dont have to define classes and are not constrained to class types.
>>
>>56195357
What about programming prevents you from exercising?
>>
>>56196406
Being specialized is a trade-off for sure, but it has paid me pretty well for the last six years. If I had to break out of JS into something else I would struggle for a bit, but if I wasn't completely subsumed in JS I wouldn't be making six figures working from home with my two kids.
>>
>>56197517
>First-class functions and anonymous functions are great.
Welcome to Lisp two decades ago.
>>
>>56194829

Because it's powerfull.

You can do functional style programming with stuff like currying, clojures and so on. And you can go OOP if you want.

ECMAScript 2015 is way better than any Version of JS before, it's a huge step foreward.


In C you can easily "shoot yourself in the foot".. One wrong pointer? BANG! here goes your day..
JS is very forgiving.


>>56194962

>Ruby and Python would make for a shitty browser language

Python would not be suited for browsers, but Ruby would be glorious.
You have god-tier functional programing, superior meta programming and the object model is also pretty cool, i.e. Singleton classes.


>>56195108

>No, ruby is a meme.

Ay, then why so many modern languages try to copy it's syntax? Let me guess: you never made a single programm with Ruby but you heard (probably from /g/) that funny "LOL muh code artisan hipster meme"-meme?
>>
>>56198065
>homoiconicity in a web API could never work
What brand of mental retardation is this? Apple?
>>
File: 1431812991388.png (189KB, 296x306px) Image search: [Google]
1431812991388.png
189KB, 296x306px
>>56198167
Never claimed it was new, just said it was nice. I've used Lisp myself.

So most of my work is done in Java and functions certainly are not first-class there. There are ways to get similar functionality now using wrappers but it's not nearly as seamless as JavaScript.

I'm not the biggest JavaScript fan, but give credit where credit is due. Some things are handled very well. These people trying to use JavaScript for the back-end confuse the hell out of me though.
>>
>>56197768
This returns an object from object literal:

function f() {
return {
foo: 'bar'
};
}


This (same function, different formatting) returns undefined:

function f() {
return
{
foo: 'bar'
};
}


because JavaScript assumes you might've accidentally ommited a semicolon after return so it silently inserts it for you.

>inb4 can't reproduce in some obscure JS implementation
Can't be bother to check but it's probably a part of ES specification, works that way in all browsers.
>>
>>56197664
what kind of control systems? why not a computing language like scipy/matlab/julia?
>>
>>56198511

I just checked it and you're right.
But honestly I can create wierd examples that do something you don't expect in almost any langauge..

That's why you have to be carefull in JS and always keep a good formatting style, but it's not a big problem if you know the quirks.
>>
>>56198511

It gets clearer when you write it like this:

function f() {
return {foo: 'bar'};
}


function f() {
return
{ foo: 'bar' };
}


By your formatting you indicated that you create a object after the return statement, like this:

function f() {
return
var x = 0
}
Thread posts: 170
Thread images: 11


[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.