I need to display the this.name in the console when clicking the button element. I could replace inside clicked() and set console.log(myBtn.name) but I’d like this method to work with any object. Is there a way to do it? When I click I get an empty string. Thanks! Answer You was almost there The problem…
Rollup unexpectedly generates a file for reactive state
I’m kinda of new to rollup, and been having several issues with it over the last couple of weeks. I’m currently using rollup to build Lit components to production. And for some unknown reason, when it generates a file which contains, what I believe is the reactive state for every component –…
How to import an useState object from another folder
I have a project which created in “Creat React App” and i have an useState array which looks like this: This array is in another folder inside a component called StateComp, but i also want to load this array in the main folder (App.js for this case). I tried to just import the State and the setSta…
Adding dynamic date to a static webpage
I want my static webpage timezone needs to be relative to CST, so if client(CST) open this file it should show CST date and Myself(IST) if I open this also it should show only the CST, could anyone please help me on this HTML file- JS file- Answer You shouldn’t try to assemble a date string yourself. Bo…
How to generate safe RSA keys deterministically using a seed?
How do we use a mnemonic list of words as a seed (like we have been become accustomed using cryptocurrency wallets) to be able to recover a private key in case it gets lost, accidentally erased, or stuck on a broken device? This could be useful for e2e encryption between clients: the keys are supposed to be g…
Do-While loop output is undefined
the console shows undefined for the following loop. the issue is in array[i] as it says i is undefined but it is the index for the loop elements. I don’t want to change the x to I as I want to run the code only once and test that it will stop as x is not < 5. Answer so
Separating (n) keys from array of objects into a single array with keys names
I need to perform filter in the array of objects to get all the keys. Although, whenever there is a obj inside of that key, I would need to get the key name and concat with the key name from the obj, so for example: I could manage to do the above code, but, if there is more objs inside
Sum of values in javascript object
I have the following javascript object I’m trying to get the sum of all values where it says ‘prijs’ (it’s in dutch) Is there an ‘easy’ way to do this? EDIT: Thanks everyone for the amazing replies! I got it to work thanks to you guys. Answer Its not totally sexy – an…
how to display multi dimension array values on screen
Hi, using above code I get the data on console but I want to disply on screen in tabular form. This data is getting from multiple sheets from a single file. I tried forEach, JSON.parse() but not able to get success. Can anyone help me how to display using angular Answer Consider that you know all sheets and t…
How is the third line of code here creating a reverse array?
This function should be taking an array and reversing its order. It works but I don’t understand what the third line “for (let i = arr.length…” is doing. Can someone please explain what is being pushed to the new reversed array? Answer For the line: The for loop is starting at the last…