Skip to content

Category: Questions

How to get all values in a data table

I am trying to get all the values in a JavaScript data table but whenever I try it says, “table.length is not a function” or, “table.size is not a function” (I’ve tried both). Here is the code I want to use: I want it to return an integer value to the console. How would I do this…

Trying to position JavaScript variables

I’m just learning javascript and I’m trying to center the theDate var by using the style tag but it stays to the far left anyone see where I’m going wrong? Answer your css is centering the element with the id theDate, so wrap that string in a with that id document.write(‘<div id=&#8…

Migrating from Babel to SWC with React

TL;DR How to translate a node script like this: to use SWC instead of Babel? Context We recently upgraded our Next.js version. Next.js now supports SWC instead of Babel. The unit tests for React in our project are written with RITEway. The test command is: It transforms the files with Babel first because othe…

innerHTML returns undefined – JavaScript

I’m creating a game on the web for my studies. I need to create a card game where each card has its own data (number and power name), data is taken from data.txt and put in an array that is then randomized. data.txt looks something like this: Play() function scrambles the deck when the PLAY button is pr…

Divergence with lookahead RegExp

I’m doing a test where all links that don’t have ‘investing’ and ‘news’ are rejected, but I’m not understanding the logic of ?= and ?!, and I believe I’m doing something wrong since the opposite of the logic below is not being matched. Could someone give me a li…