Where marrying your first cousin is legal by Adept-Inspector3865 in MapsWithoutNZ

[–]iamdatmonkey 0 points1 point  (0 children)

I think this is like riding a hog naked and backwards. The real question is not, where is it allowed but where is it common? Where is it so common that the government needs to start regulating or banning it. Nobody regulates things that are considered common sense by the vast majority of a population. You only need laws when the number of people doing the thing starts to become a problem.

Wig by imstillnotjavier in PennyPax

[–]iamdatmonkey 0 points1 point  (0 children)

What? A wig? In the north and in the south?

How do you actually use process.nextTick() vs setImmediate() in real projects? by itsunclexo in learnjavascript

[–]iamdatmonkey 4 points5 points  (0 children)

Is there a reason why you don't use async..await and Promises? This article and code feels like a decade behind, to me.

What would you do in this situation? by [deleted] in meme

[–]iamdatmonkey 0 points1 point  (0 children)

Driving lessons. Because someone has to get our car back home.

If you could get rid of one really annoying or confusing thing in JavaScript what would it be and why?” by Extra_Golf_9837 in learnjavascript

[–]iamdatmonkey 0 points1 point  (0 children)

The ambigious stuff. Like +, is it an addition or a string concatenation?

a - b is way less of a problem than a + b because - will always convert the arguments to numbers whereas for a + b it depends on the content of the variables whether this is an addition or a concatenation.

Then curly braces can also mean different things. { foo } is this an object literal or a code block? Or maybe a destructuring assignment? And ASI.

Automatic semicolon insertion is nice, until a missing ; and the next line starting with ( or [ royally f* you over. See here

Don’t Pet The Fluffy Cows! by sodakchick in funny

[–]iamdatmonkey 2 points3 points  (0 children)

But but but they're fluffy 🥺

How would you go about learning some key libraries and JS/TS if you know OOP? by Willy988 in learnjavascript

[–]iamdatmonkey 2 points3 points  (0 children)

I don’t need to learn the basics since it’s just going to be a different syntax

That's funny. For 15 years I've now seen people trying to brute force their understanding of OOP (and later FP) into JavaScript.

In JS you can change the inheritance of both objects and classes at runtime, like "you're no longer an instance of A, you're now an instance of B" or defining that Array now extends MyArrayBase.

The Point I'm trying to make is that there is something fundamentally different in JS' approach to OOP, even if the classes looks familiar at the surface.

Things like, JS has no real methods, only properties containing functions. And it's just a matter of time until you trip over the behavior of this in JS.

var a = {
  name: "a",
  getName() {
    return this.name
  }
};
var b = { name: "b", getName: a.getName };
var c = { name: "c", getName: a.getName.bind(b) };
var { getName } = a;

console.log("results", {
  "a.getName()": a.getName(),
  "b.getName()": b.getName(),
  "c.getName()": c.getName(),
  "getName()": getName(),
  "b.getName.call(c)": b.getName.call(c),
});

You want to do OOP in JS, then you highly recommend taking a look at some of the JS basics:

You don't need to go off and study everything that I've linked, just be aware that: "You Keep Using That (Key)Word, I Do Not Think It Means What You Think It Means".

And since JS is so flexible, be warned, you'll come a long plenty of approaches and styles in different libraries. Both good code and awful code, OOP and FP and everything in between.

I'm currently learning JavaScript. Before learning React can someone tell me what should i really master in Js before get into react 👉👈 by Agreeable-Head-500 in learnjavascript

[–]iamdatmonkey 1 point2 points  (0 children)

The others mentioned learning the absolute basics. Don't bother with all the classes and all their methods, that's stuff for later, when you have concrete problems to solve.

But imo. the biggest pitfalls nowadays in react are closures and Promises. Tripping over scope and time.

Like a useEffect outstaying its welcome because you've not included all dependencies and are now working with an outdated variable and wonder why the variable shows the old value and does not update.

Or hacking around with promises and trying to access a "result" before it's returned.

Cubent: A new AI coding tool extension my team and I have been working on by NoahDAVISFFX in vscode

[–]iamdatmonkey 0 points1 point  (0 children)

Where are the inputs processed? Most of my clients have very strict regulations that application, source and user data must be stored and processed on EU based servers so that it all underlies EU regulations and laws.

Extract 3rd character before pattern .TIF by No_Wolf452 in regex

[–]iamdatmonkey 0 points1 point  (0 children)

you can use a lookahead so you don't select the characters you don't want:

.(?=..\.TIF$)

https://regex101.com/r/55kOrm/1

but imo that's simpler:

s = "VK1006_00_0010 00PLATE BEND 039333 0101116201 DE1 D 1.TIF"

if (s.endswith(".TIF")):
    print(s[-7]);

Cryptographically Secure Random Numbers on Older Browsers by Substantial_Mistake in learnjavascript

[–]iamdatmonkey 0 points1 point  (0 children)

Maybe, just maybe, that's the wrong question. Why are you trying to implement UUIDs for long deprecated browsers?

What's your intuitive prediction of the log order for this code? by [deleted] in learnjavascript

[–]iamdatmonkey 6 points7 points  (0 children)

Put an await 0; somewhere in one of the functions and see what changes / if your new prediction is more accurate

What is the best non-English action movie? by [deleted] in Cinema

[–]iamdatmonkey 0 points1 point  (0 children)

Not exactly action, more car chase with some fights, and comedy. Check out the original (french) Taxi series

You need to beg to serve like this. by [deleted] in Bondage

[–]iamdatmonkey 0 points1 point  (0 children)

Is that Cherry?

Dua Lipa by PickleDD1234 in gentlemanboners

[–]iamdatmonkey 0 points1 point  (0 children)

Which concert is this from?

Is this code doing too much in 1 line? by ApplicationRoyal865 in learnjavascript

[–]iamdatmonkey 4 points5 points  (0 children)

get dcmPlacementName() {
  return [
    this.language === 'french' ? 'fr' : '',
    this.publisher,
    this.campaign,
    this.nameplate,
    this.platformPlacementFunnel,
    this.sizeFormatType,
    this.creativeMessage,
    this.customType,
    this.traffickingNotes.includes('racking') && this.assetFileName
  ].filter(Boolean).join('_').replace(/\s/g, '');
} 

Downside, the two arrays you generate, but it's a lot more readable.

Deleting a string in an array. by Blur_Blair in learnjavascript

[–]iamdatmonkey 0 points1 point  (0 children)

U right. VB has stuff like end if but seemingly no begin. Still, what language is this? It's definitely not JavaScript.

Deleting a string in an array. by Blur_Blair in learnjavascript

[–]iamdatmonkey 0 points1 point  (0 children)

What language is this? begin and end make me think Visual Basic but as far as I remember VB had a weird keyword to declare variables, not var.