TMvK
  • Home

js

A collection of 4 posts

input

Quickie: JS - input change

Many developers try to handle change of input value with change or keyup/keydown event listeners. Well, that's not enough. You can change the value also by: dropping selected text, copying it to

TvK
toFixed

Quickie: JavaScript decimal multiplication

Another oddity of JavaScript I found. Multiplying decimal numbers can be tricky (or malicious?). Order of numbers can matter in multiplication. // order #1 135*1.15*10.5 // = 1630.125 // order #2 1.

TvK
php

Quickie: a = b || c

This little post can be handy specially for full-stack devs, who use JS and PHP. PHP being a requirement here. Do you know what happens when you assign OR-logical expression to a variable?

TvK
javascript

Quickie: round()

Once again, different programming languages give different results. Now let's focus on rounding negative numbers. Python + PHP print(round(-1.5)) # -2 print(round(1.5)) # 2 echo round(-1.5) // -2 echo

TvK
TMvK © 2025
Latest Posts Ghost