Skip to content

Tag: javascript

How to match multiple words in multiple lines

I have a multiline text, e.g. I need to see if two words present in whole text (AND operator). I tried something like: Answer You can try this regex: [sS] matches literally everything, encluding line wraps b is the word bound, so word1 count but sword1 does not. And since you treat all the lines as a whole, y…

JavaScript create two dimensional array

I’m new to JavaScript, I’m trying to solve leetcode question 37. I need to a create a blank two dimensional array, I initially used the method in the comments; however, it doesn’t work correctly, it will change all the value. Then, I used the for loop method to create array and currently it …

My app doesn’t close on button, electron.js

I have this electron.js app and I would like the application to close when I click on the text with class closer. Here is my code: HTML main.js initialization electron closer.js My problem is that clicking the button, doesn’t work. What should I do? Answer I think you can do it with a loop like this.

Adding shine animation not working in special cases

I have this function to shine any text element which is passed to it. The first example here works fine (the second example doesn’t work, I provide this in case this can help us find out the issue): I expect this function work in any satiation but unfortunately we have this second example in which the f…

Populate using v-for loop in VueJS

I am new to VueJS and I just figure out how to populate Select Options box using v-for loop. Here is the list I have. This is our desired output. Answer Luckily for you, Vue can loop through the properties in an Object as described in v-for with an Object. I’ve also included a snippet below which should…

Buttons act weird due to .classList.toggle

I have a menu with some arrow buttons. If you click on those arrow buttons, one more div appears. It’s working fine – but I noticed something strange. If I press on the right arrow 9 times (until all the 10 divs are shown), on the left arrow 9 times (until only the first div is shown) and then try