Skip to content

Tag: javascript

removing duplicate objects inside of array

this question might look similar: Question but it isn’t. I have an array like this. console.log output I want to remove objects with duplicate Id but also, I want to keep the latest value. there’s no guarantee that the latest value will always be bigger like the example above. it could be 2,1 2,1 …

How do I toggle CSS features with JS functions

I want to run my function which then starts displaying a CSS element, I currently have CSS HTML JS (the function is called within another function, the calling of the function itself works) I’ve tried to chnange the id’s to classes, the order of .popUpNames .show and the regular .popUpNames https:…

Masking of email address using reg expression

Trying to develop masking for email address using reg expression but not able to achieve the desired result. Input : harrypotter@howarts.com After masking I am looking for result something like this: What I tried is this reg expression: Answer Your question needs some clarification. Here is an answer making s…

Populate field then find – mongoose

I have a Cheques and a Payees collection, every cheque has its corresponding Payee ID. What I’m trying to do is to write some queries on cheques, but I need to preform the searching after populating the payee (to get the name) I guess what I’m trying do is fit this somewhere in my code, I have tri…

Plus point on each click

I am making a game with img´s each time that the user clic on the correct img win 100 points but i dont get the summations of the points i dont know why The final score still 0 HTML JS Answer I have made the finalScore as global variable and moved the logic to a function. It is working as

How to add in react-native script in python?

Also i have got a new project, where nedded make a voice recognition (speech-to-text) , but i have’t find a worked library in react-native. How can i connect scripts in python to react native project? I only find how to make autorizathion in python, but by me it was maked in JS Answer If your python app…

How to make my letters change colors periodically?

Im trying to make the inner html of a div to change colors. My div looks like this and my javascript looks like this the result of that code is basically every letter in the banner array gets the first color from the color array, then the second color, until i end up with all the letters being the last