Reddfugee42,
  1. Ubiquity
  2. Easy adoption for those familiar with C family of languages
someacnt_,
  1. It at least feels slightly little bit like lisp.
  2. Shit I’m f*ed

… ah right, it runs on any browser. Lame

AVincentInSpace,
  1. It runs in the browser
  2. Web developers know it already so we might as well
Steamymoomilk,

You can make minecraft mods

AVincentInSpace,

that’s java

JustARegularNerd,

There’ll be a modloader in the next 5 years that will have you load .js scripts as mods

derpgon,

Everyone know JavaSript is a Java, but you don’t have to compile, so you script in it.

^/s^

KillingTimeItself,

hmm, let’s see.

It’s not java.

It’s also not a scripting language.

also to the repeat grammar nazi in the comments here, hi, “its”

jve,

It’s not a scripting language?

KillingTimeItself,

bash would be a scripting language, though to be fair, i also consider bash to be pseudo code as well.

If JS is a scripting language, than any other language is a scripting language. And technically, every language can be used to script, so therefore, is a scripting language. i’m referring to the aspect of a scripting language being generally constricted.

palordrolap,

Depends on how you define "scripting language".

Older techs remember when it was only browser-based and they thought of, and perhaps still think of, "scripting languages" as something that would run from some command-line or another. Starting a GUI browser to run a mere script was a ridiculous concept. (There was also that JavaScript had no filesystem access. At least initially. And then it became a gaping security hole, but I digress.)

Today, there exist command-line accessible versions of JavaScript but even there (I figure) most people wince and choose anything else instead. Maybe even Perl.

But another definition of "scripting language" is "(any) interpreted programming language" and where it runs is unimportant.

From that perspective, sure, JavaScript qualifies. And so does QBASIC.

Sonotsugipaa,
@Sonotsugipaa@lemmy.dbzer0.com avatar

Hot take: A scripting language is a programming language whose execution starts from the beginning of the file | stream.

shasta,

A script is just a file that can execute a series of commands without the need to compile

Centaur,

They compile in some point of time because CPU don’t know shit about Javascript. But that is for some other discussion.

Edit: typo

dan,
@dan@upvote.au avatar

Are you referring to AOT compilation specifically? JavaScript in V8 is JIT compiled if it’s “hot” (executed enough that the cost of JIT compilation is less than the cost of continuing to run it in interpreted mode).

inetknght,

It’s also not a scripting language.

It definitely is a scripting language.

hello-world.js:


<span style="font-style:italic;color:#969896;">#!/usr/bin/env node
</span><span style="color:#323232;">
</span><span style="color:#795da3;">console</span><span style="color:#323232;">.</span><span style="color:#0086b3;">log</span><span style="color:#323232;">(</span><span style="color:#183691;">"Hello world"</span><span style="color:#323232;">);
</span>

Your favorite command line tool:


<span style="color:#323232;">chmod +x ./hello-world.js
</span><span style="color:#323232;">./hello-world.js
</span>

You just need to install npm, eg via apt-get install npm.

KillingTimeItself,

everything is a scripting language if you try hard enough.

AstridWipenaugh,

!!isAdvantage

vocornflakes,
  1. Ubiquitous; insane amount of libraries and probably some of the best documentation of any language
  2. JS lambda function syntax is nice
ColeSloth,

A lot of people are familiar with it and…um…hackers like it being in use?

mokus,
  1. Job security
  2. its not COBOL
itsnotits,

It’s* not

FractalsInfinite,

If you are understood buy you’re audience, you have spoken correctly. Correcting someone’s grammer is pointless

roguetrick,

I dunno what correcting someone’s grammar has to do with paying off your readers. Sounds expensive.

toastal,

This isn’t speaking, but writing (or typing). Using ‘correct’ spelling & grammar helps ESL speakers read the language as well as those relying on text translation software. Some folks make typos & it’s fine to make mistakes but it’s also strange to act like it’s just as easy to understand. Apostrophes have a specific meaning & many folks rely on them for understanding.

I’m learning a foreign language now & I can tell you it is a massive stumbling block when you run into what you think is a new word, but is ‘just’ a misspelling.

My issue with this account is not its corrections, but if you want to be the correction bot, at least get the typography right too. is as ASCII holdover & it should be .

RichieRich,

😂😂😂👍

Thann,
@Thann@lemmy.ml avatar
  1. Its not java
ulkesh,
@ulkesh@beehaw.org avatar

Which is a blessing for Java.

itsnotits,

It’s* not

humbletightband,

It is

sirico,
@sirico@feddit.uk avatar

It leads to typescript

You get surprises from npm

ByteJunk,
@ByteJunk@lemmy.world avatar

I spent way too long today figuring out why my app was doing something that it’s NOT supposed to do on weekends.

I read Luxon’s docs (pretty cool lib tbh) again and again, and tried everything I could think of to get isWeekend to return a sane result.

Turns out I was pulling a somewhat older version of Luxon, where isWeekend didn’t exist. In any sane language, I expect I’d get a huge warning about a property that doesn’t exist, but alas…

Typescript helps me keep my sanity, but juuuuust barely.

fxdave,

That’s fair. Typescript has to cook with the existing js ecosystem.

kamen,

Weren’t you getting runtime errors for the function not being found?

humbletightband,

No, they were probably getting false every time

shasta,

Falsy* because it was undefined

However, their IDE should have highlighted it as an unknown property. Guess this guy is coding in notepad or vi.

humbletightband,

Yep, thanks for correcting me. In fact, if they write something like


<span style="color:#323232;">if (day.isWeekend) {...}
</span>

The block will never be executed with the old version of library

shasta,

Yeah that’s exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn’t match his library version.

ByteJunk,
@ByteJunk@lemmy.world avatar

My dude, you need to understand that all that anger and resentment, it is not you. It’s the years of JavaScript poisoning your mind.

In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it.

owsei,

I don’t know how luxon works, but isWeekend could be a property instead of a function

ByteJunk,
@ByteJunk@lemmy.world avatar

It is. It also happens to be undefined, and checking that for truth is how I was bitten.

mynameisigglepiggle, (edited )

If isWeekend doesn’t exist, then the weekend doesn’t exist, so it’s naturally false.

That’s why JavaScript gets pushed so hard - it’s part of the capitalist agenda to keep us working 7 days a week

Thcdenton,
Shape4985,
@Shape4985@lemmy.ml avatar

Damn this is hard. I keep java script disabled by default so its hard to say anything good. I begrudgingly have to whitelist websites i need that cant run without it.

ADTJ,

I feel like that’s more because you don’t want websites you visit running code than because you dislike this particular programming language

Shape4985,
@Shape4985@lemmy.ml avatar

Thats true. It is more to do with code execution than the language itself.

Tenkard,
  1. You can call it “Java” to enrage other programmers
  2. You can compare numbers against strings without wasting time converting them
neclimdul,

Array(16).join(“wat” - 1) + " Batman!";

nxdefiant,

JavaScript: :wide eyed and smiling: Sure why not! You’re the boss!

Python: Sighing and downing half a bottle of Advil: Sure. Why not, you’re the boss.

TrickDacy,

If you’re living in 2002 and not using the strict equality operator, that’s on you

luciferofastora,

But what if I don’t want strict comparison? What if my frontend contains a text field for a numeric input and I wanna manually check against each possible valid input value if (input_val == 1) {…} else if (input_val == 2) {…} else if… without having to convert it first or check that it’s actually a number or fix my frontend?

(I’m sure there are valid use cases for non-strict comparison, I just can’t think of one right now)

PrettyFlyForAFatGuy,

why wouldn’t you just convert inline? (Number(input_val) === 2)

Converting would mean you could use a switch statement with your example rather than an if else ladder


<span style="color:#323232;">switch(Number(input_val)) {
</span><span style="color:#323232;">  case 1:
</span><span style="color:#323232;">    doTheFirstThing();
</span><span style="color:#323232;">  break;
</span><span style="color:#323232;">  case 2:
</span><span style="color:#323232;">    doTheSecondThing();
</span><span style="color:#323232;">  break;
</span><span style="color:#323232;">  case 3:
</span><span style="color:#323232;">    doTheThirdThing();
</span><span style="color:#323232;">  break;
</span><span style="color:#323232;">}
</span>
luciferofastora, (edited )

If you’re looking for good code, you missed the point of my comment 😄

If I was looking for an enumeration of valid inputs, I’d make it a selection box rather than a text field that’s supposed to contain a number and give the selections reasonable names. If I want an integral quantity, I’d use a number input field.

If I have no control over the frontend, that means I’m writing a backend in JS for a bullshit frontend, and no amount of good coding practice is going to salvage this mess.

I’m also blessedly far away from WebDev now. I work in Data Analytics and if I ever have to do any of this for a living, something has gone very wrong.

Converting texts into numbers or dates still haunts me though - fuck text inputs for numbers and dates.

nxdefiant,

The scripting language formerly known as Java.

BeefPiano,
  1. It has the simplest multi-threaded implementation: no threads!
  2. You can goof off while your build system takes 20 minutes to rebuild a non-compiled language
Hotzilla,

node_modules size of a Linux distro

kevincox,
@kevincox@lemmy.ml avatar
  1. Is available to be used in website scripting.
  2. Not quite as full of footguns as PHP (although it is close).
xmunk,

PHP is actually quite footgun free these days.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programmerhumor@lemmy.ml
  • kavyap
  • thenastyranch
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • InstantRegret
  • Youngstown
  • vwfavf
  • slotface
  • everett
  • osvaldo12
  • rosin
  • khanakhh
  • megavids
  • tester
  • Durango
  • tacticalgear
  • GTA5RPClips
  • cisconetworking
  • ethstaker
  • cubers
  • normalnudes
  • modclub
  • provamag3
  • Leos
  • anitta
  • JUstTest
  • All magazines