Skip to content

Tag: arrays

Javascript: Duplicate each string value in an array

Tried googling for a while but couldn’t find my answer. I am trying to take a 3-character string and convert it to a 6-character string in which each of the 3 characters is duplicated. For example, 3ff would become 33ffff. First, I’m turning the string 3ff into the array [“3”, “f…

Using a for-loop to retrieve elements from an Array

I’m new to JS and keep running into issues for a recent class assignment. I’ve reached out to my professor for help but I’m still not understanding it. For our assignment, I need to use a for-loop to retrieve elements from my beatlesArray and concatenate them into a string variable with this format if the ima…

filter value of select to do a partial sum

Having two classes professor and student: professor.ts student.ts To add up the scores of each student relative to his teacher I did: This is the HTML of the page: How can I do a partial sum of the selections, assuming for example that I have 5 professor with 1 student for every professor, and want to add onl…

myComponent.map is not a function

I have this information right now that i’m saving and trying to pass to a component who then tries to create Tabs and TabPanel (Material-ui components) with said info. The declaration of that info goes as follow : I then proceed to pass said info to my component: On the other side i have an interface th…

Want to remove previously appended table

When I Click on submit button after clicking on the links it appends perfectly but when I hit the button again it doesn’t remove previously appended table. I want to clear the previously created table when user clicks on the cross button and then print the table again or else overwrite the table but ins…