Skip to content

Author: admin@master

Array Reverse is not working for me …

Consider the following code (React JS code): Notice the console.log. Lets see an image: Last I checked, reverse should have reversed the order of the array. Yet it doesn’t. Am I Using this wrong (official MDN Docs)? Why isn’t reverse working? Answer As described at https://developer.mozilla.org/en…

Matching words starting and ending with same vowel letter

I am trying to come up with a regex to match words starting and ending with same vowel. My question is, is this an elegant all-encompassing solution or am i missing something? So far this is what I have come up after a quick brainstroming. My preferred environment is javascript/python without special librarie…

Halt Leaflet event propagation

I am working on a project that uses Leaflet. I have a big map that I am rendering in a browser div, and I am rendering a popup div (using z-ordering) above it when a user clicks on an element. The problem is that if you click on the ‘pop up window’ and drag, leaflet drags the underlying map as

flatten an array recursively

I tried to implement an array flatten function recursively. Here is the code: But I don’t know why the result is not correct. Please help me explain it. Answer The concat() method returns a new array comprised of the array on which it is called joined with the array(s) and/or value(s) provided as argume…