Skip to content

Tag: javascript

Defining listener function inside function

When I define a function outside the function, I cannot access the glide parameter: Hence, I have did something like that: I want to know if it is hack or good practice? Is there more convenient way for doing this. Answer Having the function outside is better. Mainly for readability and testing, but if your f…

Trying to change background color on same valued inputs

I’ve been trying to change the input on a same valued inputs. The input ids are (Input${i} (Input0 , Input1 and etc., iterating them with loop), I have a button which evokes the function, The best I got so far is this: Answer I think you probably want to learn to do something like: You’ll notice t…

JavaScript sort value by arrow function

in JavaScript , we can use array.sort((a, b) => a-b) to sort the array in increasing order. I know that we pass a function into the sort to customize it. It is said when a – b = positive value, then place b in the first, like (b, a) descending order. I wonder how this positive value influence the ord…