JavaScript: Event Capturing and Bubbling [event propagation in detail]

If you are designing some event-heavy component using JavaScript, then the propagation of the event becomes very critical. Any event like “click”, “hover” etc. has 2 ways of traveling through the components. To understand the capturing and bubbling, we need to understand the params of “addEventListener” method of EventTarget. Here is the signature of “addEventListener”.

Redis: Backup and Restore [ full DB and single key ]

Here are the processes to backup and restore data from and to the Redis server. Though the restore and back is not a frequently used process, but this becomes crucial in certain use cases. Also moving data from one Redis server to another is a very handy process when we need that. Here we have discussed 2 processes for the backup and restoration of the Redis server.

JavaScript: “use strict” – [strict mode]

“use strict” directive enables a strict operating context/mode for the code. This helps us to identify potential exceptions and makes debugging easier. In strict mode, we are notified about code that would trigger some weird behavior or fail silently. To enable the strict mode for the whole script, add the string “use strict” at the top of the script.

Redis Command: LSET

Change/replace value at a specific index of a list. For the command to work there should be an existing list, with some items and we can only change items that are already set(have an index). Both positive and negative indexes will work for this command. Index is zero(0) based. So the first item is considered at index Zero(0).

Redis Command: LPOP

LPOP removes the first element from the Left/HEAD of the list and then returns it. Count is an optional argument provided for the command, this is used to pop multiple items. If the list has no element left after executing the LPOP command, then the list is deleted after the item(s) popped.