Javascript – Paolo Redaelli https://monodes.com/predaelli A civil engineer with a longlife fondness for Software Libero Wed, 13 Nov 2024 22:53:58 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 91795679 https://monodes.com/predaelli/2024/11/13/12034/ https://monodes.com/predaelli/2024/11/13/12034/#respond Wed, 13 Nov 2024 22:52:43 +0000 https://monodes.com/predaelli/?p=12034

Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It’s the answer to the question: “If I sit down in front of a blank HTML page, and want to start being productive immediately, what do I need?” … and the tie to go along with jQuery‘s tux and Backbone‘s suspenders.

Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.

]]>
https://monodes.com/predaelli/2024/11/13/12034/feed/ 0 12034
Bun — A fast all-in-one JavaScript runtime https://monodes.com/predaelli/2024/09/23/bun-a-fast-all-in-one-javascript-runtime-2/ https://monodes.com/predaelli/2024/09/23/bun-a-fast-all-in-one-javascript-runtime-2/#respond Mon, 23 Sep 2024 21:03:28 +0000 https://monodes.com/predaelli/?p=11932

Bundle, install, and run JavaScript & TypeScript — all in Bun. Bun is a new JavaScript runtime with a native bundler, transpiler, task runner, and npm client built-in.

Gonna try this Bun — A fast all-in-one JavaScript runtime

]]>
https://monodes.com/predaelli/2024/09/23/bun-a-fast-all-in-one-javascript-runtime-2/feed/ 0 11932
State of JavaScript 2023 https://monodes.com/predaelli/2024/06/29/state-of-javascript-2023/ https://monodes.com/predaelli/2024/06/29/state-of-javascript-2023/#respond Sat, 29 Jun 2024 18:07:06 +0000 https://monodes.com/predaelli/?p=11779 State of JavaScript 2023

The 2023 edition of the annual survey about the latest trends in the JavaScript ecosystem.

]]>
https://monodes.com/predaelli/2024/06/29/state-of-javascript-2023/feed/ 0 11779
Bun — A fast all-in-one JavaScript runtime https://monodes.com/predaelli/2024/04/03/bun-a-fast-all-in-one-javascript-runtime/ https://monodes.com/predaelli/2024/04/03/bun-a-fast-all-in-one-javascript-runtime/#respond Wed, 03 Apr 2024 18:42:55 +0000 https://monodes.com/predaelli/?p=11556

Bun — A fast all-in-one JavaScript runtime

Bundle, install, and run JavaScript & TypeScript — all in Bun. Bun is a new JavaScript runtime with a native bundler, transpiler, task runner, and npm client built-in.

]]>
https://monodes.com/predaelli/2024/04/03/bun-a-fast-all-in-one-javascript-runtime/feed/ 0 11556
multithreading.io https://monodes.com/predaelli/2024/01/11/multithreading-io/ https://monodes.com/predaelli/2024/01/11/multithreading-io/#respond Wed, 10 Jan 2024 23:23:15 +0000 https://monodes.com/predaelli/?p=11177 Multithreading functions in JavaScript to speedup heavy workloads, designed to feel like writing vanilla functions. multithreading.io

]]>
https://monodes.com/predaelli/2024/01/11/multithreading-io/feed/ 0 11177
javascript – Can (a== 1 && a ==2 && a==3) ever evaluate to true? – Stack Overflow https://monodes.com/predaelli/2023/11/21/javascript-can-a-1-a-2-a3-ever-evaluate-to-true-stack-overflow/ https://monodes.com/predaelli/2023/11/21/javascript-can-a-1-a-2-a3-ever-evaluate-to-true-stack-overflow/#respond Tue, 21 Nov 2023 19:25:00 +0000 https://monodes.com/predaelli/?p=10970 javascript – Can (a== 1 && a ==2 && a==3) ever evaluate to true? – Stack Overflow

Yes, it can. IMHO it is one of the several undesirable consequences of loosely typed languages. In fact, according to an almost anonymous user:

If you take advantage of how == works, you could simply create an object with a custom toString (or valueOf) function that changes what it returns each time it is used such that it satisfies all three conditions.

const a = {
  i: 1,
  toString: function () {
    return a.i++;
  }
}

if(a == 1 && a == 2 && a == 3) {
  console.log('Hello World!');
}

The reason this works is due to the use of the loose equality operator. When using loose equality, if one of the operands is of a different type than the other, the engine will attempt to convert one to the other. In the case of an object on the left and a number on the right, it will attempt to convert the object to a number by first calling valueOf if it is callable, and failing that, it will call toString. I used toString in this case simply because it’s what came to mind, valueOf would make more sense. If I instead returned a string from toString, the engine would have then attempted to convert the string to a number giving us the same end result, though with a slightly longer path.

Worst, it is also possible using the === operator!

var i = 0;

with({
  get a() {
    return ++i;
  }
}) {
  if (a == 1 && a == 2 && a == 3)
    console.log("wohoo");
}

This uses a getter inside of a with statement to let a evaluate to three different values.

… this still does not mean this should be used in real code…

Even worse, this trick will also work with the use of ===.

  var i = 0;

  with({
    get a() {
      return ++i;
    }
  }) {
    if (a !== a)
      console.log("yep, this is printed.");
  }
]]>
https://monodes.com/predaelli/2023/11/21/javascript-can-a-1-a-2-a3-ever-evaluate-to-true-stack-overflow/feed/ 0 10970
SpaceVim has Eiffel support! https://monodes.com/predaelli/2022/10/01/spacevim-has-eiffel-support/ https://monodes.com/predaelli/2022/10/01/spacevim-has-eiffel-support/#respond Sat, 01 Oct 2022 10:49:41 +0000 https://monodes.com/predaelli/?p=9687 SpaceVim, a community-driven vim distribution that seeks to provide layer feature, besides turning Vim into a nifty IDE for several languages (C/C++, Rust, Kotlin, Go, Python, Java and JavaScript plus others), it offers among the available layers one for Eiffel!

 

]]>
https://monodes.com/predaelli/2022/10/01/spacevim-has-eiffel-support/feed/ 0 9687
7 More Killer One-Liners in JavaScript | by Tapajyoti Bose | Apr, 2022 | Medium https://monodes.com/predaelli/2022/04/28/7-more-killer-one-liners-in-javascript-by-tapajyoti-bose-apr-2022-medium/ https://monodes.com/predaelli/2022/04/28/7-more-killer-one-liners-in-javascript-by-tapajyoti-bose-apr-2022-medium/#respond Thu, 28 Apr 2022 18:43:00 +0000 https://monodes.com/predaelli/?p=9317 7 More Killer One-Liners in JavaScript | by Tapajyoti Bose | Apr, 2022 | Medium

]]>
https://monodes.com/predaelli/2022/04/28/7-more-killer-one-liners-in-javascript-by-tapajyoti-bose-apr-2022-medium/feed/ 0 9317
Javascript insanity? https://monodes.com/predaelli/2022/01/23/javascript-insanity/ https://monodes.com/predaelli/2022/01/23/javascript-insanity/#respond Sun, 23 Jan 2022 16:20:26 +0000 https://monodes.com/predaelli/?p=9080

On Facebook they write

I enjoy JavaScript but this is insanity

Welcome to a language that has approximate math as the only math you can use.

In fact 7110 / 100 * 100 is 7109.99999999 because the first division cannot be exactly represented with with a floating point representation.

Sites like https://baseconvert.com/ieee-754-floating-point come handy…

Those are the moments when I rejoice for choosing Eiffel as my favourite language

]]>
https://monodes.com/predaelli/2022/01/23/javascript-insanity/feed/ 0 9080
Why You Should Stop Using UI Frameworks | by Beau Beauchamp | Nerd For Tech | Medium https://monodes.com/predaelli/2021/08/04/why-you-should-stop-using-ui-frameworks-by-beau-beauchamp-nerd-for-tech-medium/ https://monodes.com/predaelli/2021/08/04/why-you-should-stop-using-ui-frameworks-by-beau-beauchamp-nerd-for-tech-medium/#respond Wed, 04 Aug 2021 18:33:00 +0000 https://monodes.com/predaelli/?p=8592

I’ve been a web application developer for over 20 years. I’ve seen all kinds of UI libraries come and I’ve seen them go. I’ve been in the…

Source: Why You Should Stop Using UI Frameworks | by Beau Beauchamp | Nerd For Tech | Medium

I once interviewed with a really big video game company. You know what their development policy was changing to? Plain ECMA (JavaScript) and CSS. No compilers. No CoffeeScript. No TypeScript. They even ripped out jQuery. I was impressed.

]]>
https://monodes.com/predaelli/2021/08/04/why-you-should-stop-using-ui-frameworks-by-beau-beauchamp-nerd-for-tech-medium/feed/ 0 8592