Posts
-
Use button if you mean it
Use
<button>
if you want it to behave as a button. If you are using any otherHTML element
and updating its look, to look likebutton
, you are either bothering your users or yourself. -
I will never use || (OR) for default values
TL;DR;
I will never use
||
for default values, but default parameter.For example, instead of
function sort(array, startIndex, endIndex) { startIndex = startIndex || 0; endIndex = endIndex || array.length — 1; ... }
I would use,
function sort(array, startIndex = 0, endIndex = array.length - 1) { ... }
-
No sound for audio when iPhone connected over Bluethooth
All of a sudden, there was no Bluetooth audio in my car (Corolla 2016), when paired with my iPhone. It has been working fine, so far. As usual, I did not RTFM. Not sure, if that would have helped. I could have leaved with out the music but it was difficult to follow Google Map’s navigation instruction. Yes, I use Google Maps instead of the default. I had to keep looking at the phone, quite a often.
-
Do you know this?
The value of
this
in ECMAScript refers to the execution context of the function. In ECMAScript there are three execution context; namely global, function and evaluation. Following example will help to comprehend the concept better. -
Inheritance in JavaScript
Let’s consider that
square
is a special type ofrectangle
, whoselength
andwidth
are equal. Thus we can createblueprint
of asquare
by extending theblueprint
of arectangle
. I am using the termblueprint
as JavaScript/ECMAScript version prior ES2015 did not haveclass
functionality.