DEV Community

pentacular profile picture

pentacular

404 bio not found

Joined Joined on  github website

Last 250 comments

Leetcode - Reverse Linked List(with JavaScript)

Using a stack abstraction const push = (item, list) => ...

Why use pointers at all.

I've done so several times. Here is the simplest requirement...

Why use pointers at all.

Ok, and does pass-by-orange have pass-by-reference semantics,...

Why use pointers at all.

And I talked about the Java spec, which defines "references v...

Why use pointers at all.

Since we are talking about pass-by-reference, it is the seman...

Why use pointers at all.

No, you're passing the value of an int *.

Why use pointers at all.

Passing an int * in C does not pass an int.

Why use pointers at all.

That isn't what you asked. This is what I asked Are you...

Why use pointers at all.

If you believe that C has pass-by-reference semantics, there'...

Why use pointers at all.

The Java spec has defined "reference values" and then said th...

Why use pointers at all.

Let's write it out properly. "All interactions with objects ...

Why use pointers at all.

With that put down, we can now utilize language from the C s...

Why use pointers at all.

It's trivial to show that pass by reference doesn't occur in ...

Why use pointers at all.

Yes, C is very clear that a pointer isn't a reference. Its v...

JavaScript does not cache array.length

Length may be stored as a special field on some implementatio...

Why use pointers at all.

What that means is that people often abbreviate "reference va...

Why use pointers at all.

The spec does not equate references with pointers, and it's t...

Why use pointers at all.

You can't pass symbols in C. I'm talking about passing the a...

Why use pointers at all.

Ok, it's good that you've worked your logic through to produc...

Why use pointers at all.

I think the key disagreement here is on the claim that "an ob...

Why use pointers at all.

I think it comes down to the same confusion in language. Sin...

Why use pointers at all.

What you're passing are arguments. Pass by reference means t...

JavaScript does not cache array.length

Actually, it's pretty easy to do escape analysis and determin...

Why use pointers at all.

The important distinction is that the javascript language doe...

Why use pointers at all.

The semantics of these languages differ from both javascript ...

JavaScript Challenge 1: Simple Pig Latin

You might find it's simpler if you rearrange it slightly. :) ...

Why use pointers at all.

Sure. const foo = (a) => { a = { value: 2 }; }; let obje...

Is Lua Doomed?

Yes. Lua is doomed. Just like every other language. As the ...

Why use pointers at all.

A particular javascript implementation might use a vtable, or...

Why use pointers at all.

If you read the ecmascript standard you'll see that javascrip...

Why use pointers at all.

I don't think that it does differ, except in-so-far as javasc...

Why use pointers at all.

The javascript semantic are like the C semantics here because...

Why use pointers at all.

Actually, they're not const char *. A string literal produce...

Why use pointers at all.

I think it's important to note that passing a pointer by valu...

Do you know spread operator in Javascript object is mutable?

I think that perhaps you gave the article the wrong title. :)...

What Javascript Spread Operator is, How It Works and How to Use It

What's the distinction that it makes? JS doesn't allow you t...

What Javascript Spread Operator is, How It Works and How to Use It

What is the obvious difference? Every JS interpreter I've us...

What Javascript Spread Operator is, How It Works and How to Use It

I did the reading. There's nothing there that distinguishes ...

What Javascript Spread Operator is, How It Works and How to Use It

1. ReturnIfAbrupt(V). 2. If Type(V) is not Reference, return ...

What Javascript Spread Operator is, How It Works and How to Use It

let obj2 = obj1; This initializes obj2 with the value of ...

What Javascript Spread Operator is, How It Works and How to Use It

Ok, I think I see the argument that you're making, but I don'...

The new features of Javascript in 2020 (ES11)

I think it's worth noting that your dynamic import example re...

Arrays vs Linked Lists

A more crucial difference is that linked lists can share stru...

New Idea Blocked

I don't believe in innate talent, myself -- and science seems...

New Idea Blocked

Hmm, the evidence doesn't support that conclusion as far as I...

New Idea Blocked

Well, if you're not competent at something and do not want to...

End of an era ⌛

"We now generally consider Moment to be a legacy project in m...

What Javascript Spread Operator is, How It Works and How to Use It

I can't find anything about copy by reference in the ecmascri...

New Idea Blocked

Look for something that looks vaguely like what you want. Ma...

What is the difference between a junior and a senior software developer? 15 things I wish I had known sooner

The most important thing is that a senior developer should un...

I've hit a brick wall. How do I progress as a React Dev and other confusions.

There is no magic bullet. Learning is driven by surprise, fa...

Regex isn't that hard

Regex can be useful, but can also be a trap. When you use re...

Explain the challenge of generating random numbers like I'm five

It is not difficult for computers to generate random numbers ...

COVID-19 stats I wanted to see, and unanswered questions

The only important values are which exponential curves you're...

What is your personality type?

MBTI has been pretty well debunked livescience.com/65513-doe...

HOW TO STOP NEGATIVE THINKING

Negative thoughts are very valuable -- you should not try to ...

Two Ways to Rotate an Array in JavaScript

Another alternative is not to rotate the array, but to rotate...

How to write a clean code.

The other reason is that there is no "the machine". There ar...

Is "C Programming language" Still Worth Learning in 2021?

C programs are understood in terms of the CAM (C Abstract Mac...

JS, method behind the madness.

I think your example code is a bit off const array = [6,-...

Functional Programming in Javascript - Imperative and Declarative

You're welcome.

Best way to learn JavaScript

This is not really true. For example, 10 is not an object in...

Everything is Replaceable

I don't think this is quite true. There are irreplaceable pe...

7 Ways & Responses To Deal With Your Online Negative Review

Negative reviews are incredibly valuable. They provide an op...

Functional Programming in Javascript - Imperative and Declarative

I don't think this is declarative programming. I think that ...

Algebra Expression Simplifier

Yes, I think so. Perhaps even a representation as simple as:...

All you need to know about C Static libraries

You're welcome.

Algebra Expression Simplifier

Very nice. You might make it a lot simpler by restructuring ...

All you need to know about C Static libraries

I think it is worth noting that libraries are not part of the...

Implementing a Simple LRU Cache in JavaScript

Delegate the problem to the caller -- have them provide a val...

Understanding Memoization In JavaScript

The difficult problem with memoization is, as usual, cache in...

Basic Algorithm Scripting in JavaScript

So, if (Math.sign(num)) { . . . } could be replaced with if (...

Basic Algorithm Scripting in JavaScript

In what case do you think you call Math.sign with a value les...

Am I missing something in JavaScript?

Focus on understanding properly the things that surprise you....

I've always been using isNaN wrong! (and you?)

Those interfaces could have been designed to signal an error ...

I've always been using isNaN wrong! (and you?)

Yes, NaN is used to indicate that a number producing operatio...

Merge Sort

Wikipedia provides a reasonable overview of both top-down and...

Basic Algorithm Scripting in JavaScript

That's because it never gets to the if (Math.sign(num)) bit i...

Merge Sort

The critical insight for merge sort is that all sequences of ...

9 practical tips for high-performance Javascript

The most import tip is this: Use a profiler to disc...

Basic Algorithm Scripting in JavaScript

if (Math.sign(num)) { ... } Math.sign(-1) is -1, which is ...

It gone wrong, how do you deal with bad feedback?

Did the comments point out legitimate problems in the library...

10 Challenging JavaScript Quiz Questions and Answers

The page you've referenced is mostly correct, but they're a b...

10 Challenging JavaScript Quiz Questions and Answers

We can tell that === is not an identity operator since it may...

Why .then run first before the actual promise

Did you mean to write something like this? test().then(() =...

Is there a limit to the number of arguments a function can have in Python ?

In cpython (the implementation most people use), prior to ver...

If you had a time machine, what would you tell your younger self?

Just remember, this too shall pass. :)

Technique Sliding Windows algorithms

if (!!pivotLeft) { ... } Just wondering if there's a speci...

Using the Spread Operator (...) in JavaScript

We can use the spread operator again. However, when we use i...

Why programmers stagnant from an analysis of competitive gameing.

One thing that is often overlooked is that time spent in prac...

What are current limitations of search engines?

Why isn't it open to criticism?

Functional Programming Is a Leaky Abstraction

Hmm, I am unconvinced that the reason for this is due to a la...

OOP vs functional programming

You're welcome.

Pieter Levels makes $600k a year from Nomad List and Remote OK

It's probably worth pointing out that revenue is not the same...

OOP vs functional programming

I think that trying to turn functions into classes may not ha...

10 Challenging JavaScript Quiz Questions and Answers

identity (===) Just noting that === is not an identity ope...

Understanding Bind, Call and Apply in JavaScript

I think it's worth pointing out that you can bind any or all ...

Shuffle the Array (Javascript)

You're welcome.

Functional Programming Is a Leaky Abstraction

Well, in that case you're not debugging the functional system...

Shuffle the Array (Javascript)

When I see this kind of problem, my first thought is to see i...

Why do we write JavaScript like this?

Well, bad poetry isn't to everyone's taste, so it's understan...

JavaScript Functions: a breakdown.

You're welcome. :)

Arrays and objects are stored by reference

What's a memory address in javascript?

JavaScript Functions: a breakdown.

In this example, funcName is being invoked BEFORE the functi...

Arrays and objects are stored by reference

What do they point at?

Arrays and objects are stored by reference

Every distinct array has a unique value. So [] === [] create...

Arrays and objects are stored by reference

What I've understood is that object values are just like prim...

Arrays and objects are stored by reference

If you feel it has been explained nicely, why are you asking ...

Arrays and objects are stored by reference

I haven't been able to find "object references" in the langua...

(POSSIBILITIES) what languages are good to learn?

If you don't know how to program, the job opportunities don't...

(POSSIBILITIES) what languages are good to learn?

A cost like needing to write a bunch of stuff just right befo...

(POSSIBILITIES) what languages are good to learn?

The point is that you're not limited to the first language yo...

(POSSIBILITIES) what languages are good to learn?

I'm not quite sure I understand the question, and I haven't h...

(POSSIBILITIES) what languages are good to learn?

Languages and frameworks are easy; programming is hard. So, ...

Arrays and objects are stored by reference

So, it isn't part of the language?

Arrays and objects are stored by reference

I had a look in the ecmascript standard, but couldn't find an...

Writing If Statements with the Ternary Operator

You're welcome.

Why do we write JavaScript like this?

At this point you can't speak meaningfully about declarative ...

Writing If Statements with the Ternary Operator

Given that === already produces true or false the examples ar...

Data Types and Operators in JavaScript: Everything You Need To Know

"In mathematics and computer programming, the order of opera...

You Don't Know Jack About JavaScript Objects

Isn't this what Map was added to handle?

Data Types and Operators in JavaScript: Everything You Need To Know

Rather some operators take precedence over others. So 2 + 2 ...

Do you need to know how to code in order to be a good machine learning engineer?

What does a good machine learning engineer do?

Why is Web Assembly faster than Javascript ?

And in many cases it is slower, due to the interfaces require...

Why do we write JavaScript like this?

Thanks -- that was useful. The only difference between the e...

#001 DS&A - Operators and Arrays

There are such things are truly multi-dimensional arrays, jus...

#001 DS&A - Operators and Arrays

Sure: open-std.org/jtc1/sc22/wg14/www/do... 6.5.2.1 Array sub...

#001 DS&A - Operators and Arrays

What he refers to as a multidimensional array is a one dimens...

Implementing Queue with 2 Stacks

The nice thing is that you get an amortized O(1) TC and using...

#001 DS&A - Operators and Arrays

address of A[i] = i * sizeof(element) + base_address An ad...

Programming is not easy, here is the secret to mastering programming.

One secret that is often overlooked is that deleting code is ...

Why do big companies like Microsoft and Oracle want to buy TikTok? They are so powerful, can't they create one themselves?

They don't want to buy TikTok. They want to buy the users.

Algorithms Are Monsters (but don't be afraid)

It might be worth considering a different approach to finding...

NaN - It's Not A Number🙄

But in memory, it is still stored as a floating-point number...

NaN - It's Not A Number🙄

NaN isn't a numerical representation, because it isn't repres...

NaN - It's Not A Number🙄

Let's be clear that NaN is not a number in IEEE. :) It is a ...

NaN - It's Not A Number🙄

It's probably worth noting that NaN === NaN is false, which i...

Why do we write JavaScript like this?

Let's consider your reduce example. I think you've claimed t...

Comparison & Equolity Operators

NaN in identity (and in equality) operator compared with any...

Comparison & Equolity Operators

Equality ( == ) vs. Identity ( === ) Just pointing out tha...

Functional programming and pure functions

A procedure can never be called a function. However, as I've...

Functional programming and pure functions

A procedure is never a function, but it can implement a funct...

Functional programming and pure functions

I know what map is specified to -- it's in the language speci...

When DRY Doesn't Work, Go WET

The critical insight is that repetition isn't repetition when...

Why do we write JavaScript like this?

Right -- but hoping that you prefer the second, how would yo...

Why do we write JavaScript like this?

The only difference that I can see is that you've exposed the...

Why do we write JavaScript like this?

With that definition, all procedure calls are declarative, wh...

Functional programming and pure functions

It might be, if map were not specified to perform a series of...

Why do we write JavaScript like this?

None of the examples shown are declarative. I think people a...

Why do we write JavaScript like this?

I recently had a discussion where people claimed that object ...

JavaScript Katas: Merge Two Arrays

There's no good reason to limit ourselves to two, and no part...

Functional programming and pure functions

Well, the map method performs a series of operations in a par...

High Performance JavaScript

parseInt detects a leading zero on the string, it will parse...

What is a Closure? 🤔

three very important and distinct types of scope in JavaScri...

Weird behaviors of javascript: Primitive Types and Reference Types

but in the case of this article, it's a bit different: when ...

Weird behaviors of javascript: Primitive Types and Reference Types

That's fine, but for future reference, let's note that a.foo ...

Bubble Sort

A little abstraction can go a long way. const order = (arra...

Weird behaviors of javascript: Primitive Types and Reference Types

Could you be more specific about the confrontational style th...

Weird behaviors of javascript: Primitive Types and Reference Types

If it depicts 'passing a reference' not 'passing by reference...

Structure In C - Fundamentals

By convention, uppercase letters are used for type definitio...

Weird behaviors of javascript: Primitive Types and Reference Types

Could you show me where in the ecmascript standard it talks a...

Weird behaviors of javascript: Primitive Types and Reference Types

I'm glad we can all agree that javascript doesn't support pas...

What is Closure in JavaScript?

Even when a goes out of the scope of what? :)

Weird behaviors of javascript: Primitive Types and Reference Types

Ok, so we can all agree that it is pass by value. And that t...

Weird behaviors of javascript: Primitive Types and Reference Types

When I run let a = { v: 1 }; const foo = (p) => { p = { ...

Weird behaviors of javascript: Primitive Types and Reference Types

It would if it talked about object references. The reference...

Weird behaviors of javascript: Primitive Types and Reference Types

Could you point out where 'reference types' are mentioned in ...

What is Closure in JavaScript?

Closure is when a function remembers and continues to access...

Weird behaviors of javascript: Primitive Types and Reference Types

So. Pass by value, then? :) Can you take a look in the ecma...

Weird behaviors of javascript: Primitive Types and Reference Types

Try now ;)

Weird behaviors of javascript: Primitive Types and Reference Types

Not in the least. let a = { v: 1 }; const foo = (p) => {...

Weird behaviors of javascript: Primitive Types and Reference Types

There is no pass by reference in this article.

JavaScript Katas: Higher Version

The nice thing is that it should also allow you to sort an ar...

JavaScript Katas: Higher Version

Adjust the partition if you want to exclude the equal case. ...

why are there so many programming languages when they all do the same thing?

You're welcome. :)

How to Reverse a String

You're welcome. :)

why are there so many programming languages when they all do the same thing?

While most languages can do most things, they do them differe...

Roost Desktop: No more mock services or versioning pain

So the solution to mocking is to set up a complete system and...

How to Increase Team Productivity Based on Myers-Briggs Personality Types

Wasn't this debunked already? smithsonianmag.com/smart-news/...

is getting a PhD in computer science beneficial to a software engineer?

A PhD demonstrates that you can do original research. If you...

JavaScript Katas: Higher Version

A little abstraction goes a long way to improving this answer...

Functional Programming Is a Leaky Abstraction

I don't think that it qualifies as a leaky abstraction by you...

C++ Programming language Basic Concepts

I think there are a few problems with this article. I've lis...

JavaScript Data Types

I think it's important to say that it 'effectively' does this...

How to Reverse a String

We know that strings can be thought of as character arrays--...

Javascript logic

The == operator is asymmetric due to implicit conversions. C...

TIL - Spread and Copying Objects in Javascript

Truth is not a popularity contest. This is not a cogent resp...

Are BERT and other large language models conscious?

It's always easy to claim that things lack or possess undefin...

TIL - Spread and Copying Objects in Javascript

Let me know if you manage to produce a cogent response to any...

TIL - Spread and Copying Objects in Javascript

"if you are not sending snapshot of entire object, it is not ...

TIL - Spread and Copying Objects in Javascript

Read the algorithm in the ecmascript specification. Show the...

TIL - Spread and Copying Objects in Javascript

See this bit here? A Reference is a resolved name or proper...

TIL - Spread and Copying Objects in Javascript

Sure it is -- those properties aren't part of the object valu...

TIL - Spread and Copying Objects in Javascript

That's exactly what I am explicitly stating. foo(a) passes a...

The Trials and Tribulations. A Fool's Guide To Writing Functional JS (Part 4)

Since you're suggesting point-free composition it might be a ...

The Trials and Tribulations. A Fool's Guide To Writing Functional JS (Part 4)

I'm not objecting to the article -- just pointing out that it...

TIL - Spread and Copying Objects in Javascript

Then it isn't pass-by-reference, is it? :) Now see if you ca...

I failed an interview because of an algorithm

While you may not need them directly, lacking competence in t...

The Trials and Tribulations. A Fool's Guide To Writing Functional JS (Part 4)

There is no declarative programming here.

The Trials and Tribulations. A Fool's Guide To Writing Functional JS (Part 4)

Or you could just ... use variables. Then you can also have ...

TIL - Spread and Copying Objects in Javascript

I'm not complicating it. Here is a simple piece of code. l...

A Visual Guide to How to Actually Invert a Binary Tree

You have two branches -- say 'left' and 'right'. Instead of ...

I failed an interview because of an algorithm

Interviews are hard, and feedback is minimal to minimize liab...

A Visual Guide to How to Actually Invert a Binary Tree

The first insight here is that the structure of a binary tree...

Why you need to know C for hacking

C programs run in the C Abstract Machine. Access to the hard...

Random numbers using Node.js package

A pseudo-random number generator that you cannot seed is not ...

Comparing Values of Objects in JavaScript 🧭

Because primitive data types are compared by their values, w...

TIL - Spread and Copying Objects in Javascript

ECMA also says value of object reference in your link. ECM...

Top Level Await in Node

Yes, this is a major advance. :) It means that a module can ...

TIL - Spread and Copying Objects in Javascript

I'm not the one altering terminology here. Passing a copy of...

Learn Any Programming Language with This Learning Plan

learning curve less steep You want that learning curve as ...

Does Studying For Whiteboard Interviews Make You A Better Engineer?

The insight here should be that none of the above is about st...

Why array indexing in C++ starts from 0, not 1

That link is great :)

Check if an object is empty

Can you think of a situation where it would be the reasonable...

Check if an object is empty

l don't think that makes sense. When validating you would wa...

Basic tips to get rich - Ziad K Abdelnour

The most reliable method is to select rich parents. Another ...

What projects should somebody have and experience to be a senior?

The important quality for a senior software engineer is to un...

Why array indexing in C++ starts from 0, not 1

Moving from a position to an offset is easier if the first po...

Check if an object is empty

When would you ever want to test for this?

TIL - Spread and Copying Objects in Javascript

In Javascript, all primitive types are assigned and passed b...

How to go from Junior to Senior Developer

And, most of all, learn what does not matter.

Why array indexing in C++ starts from 0, not 1

sizeof (int) need not be 2 or 4, just >= 1. Other than th...

Can someone experienced in writing tests expand on the mental models of unit tests?

For correctness you want to test the transitions between vali...

Why you shouldn't use the file creation time to represent a date

Let's say that one file is produced from another. It is neve...

Can someone experienced in writing tests expand on the mental models of unit tests?

There are a number of problems tests can address. Forcing a...

Why you shouldn't use the file creation time to represent a date

File creation time should never be used for anything other th...

Leetcode - Reverse Linked List(with JavaScript)

The key insight here ought to be that a linked list satisfies...

The dilemma of a silent quick learner

What is it that you do want to achieve?

How do you deal with online criticism? And how do you not let it affect your self worth?

Start by recognizing the difference between yourself and the ...

The dilemma of a silent quick learner

Learning to communicate effectively is a critical skill. Int...

loading...