Skip to content

Category: Questions

can’t remove class after click again

I tried to color the text I clicked on by gave them a class and besides the text I click on the original color is back again, but when I click on the text twice the class can’t be removed. I use toggle class for this issue but doesn’t work. Answer Cache the main list element, and the list items,

Property “at” does not exist on Array

According to MDN Web Docs Array.prototype#at, is a valid method. But for some reasons, TypeScript refuses to compile, stating that it does not exist. Console output from tsc: I can’t use bracket notation, since the method is meant to be able to handle negative numbers. I’ve tried lots of things, i…

Count all files with specific type in folder

I’m kinda new to coding, and I need to count files with specific type in my folder, but I don’t know how to do it using fs module! My current code: Can someone help me? Answer You can use path.extname like this: Also, as mentioned by MegaMix_Craft, take care about the variable yourExtension. It ha…

chartjs 3.6.0 add X label

I used following code in Chart 2.2.1 and it worked well and we can see label Time. Now we want to upgrade to 3.6.0 due to security reasons, but snippet stopped working. I attach 2 fiddles Working 2.2.1: https://jsfiddle.net/maksim_beliaev/2ru3g5ot/8/ Not working 3.6.0: https://jsfiddle.net/maksim_beliaev/q2po…