Skip to content
Advertisement

async/await in function synchronous – JavaScript

i have this code : Why am I getting the message that forEach is not defined? Answer You are getting an error forEach is not defined because there is no such function called forEach(). There is, though, a method Array.prototype.forEach():

How can I fill the inside of a SVG?

I am trying to fill a heart shape SVG on click using html, css and javascript, but it doesn’t seem to work. Here is the svg code : I have tried multiple solutions, such as using “fill” in CSS which only fills the stroke around the svg, but also removing everything in the path from the second M which only

Change multiple words in the string (JS)

JS function finds a word in the string and encodes it as “highlight”. But how can I change the multiple words to highlight instead of a single word? For example; Before: After: Answer My suggestion: You’ve edited your question, I’ll update my answer:

How to detect overlap in Phaser.js?

I am new to Phaserjs, and I am trying to make a shooting game. I want the damage function to fire when a bullet touches plane2, that is the green plane. Can somone please tell me what am I doing wrong here? Here is my code: Here is the link to the game if needed https://shoot.abaanshanid.repl.co/ Answer This works: but

How can I find the EXACT amount of matching words in a string?

for a project I’ve written a function which includes the following: String: ‘alpha beta beta gamma’ For now I just get all the matching words. So my result would look like that: [‘alpha’], [‘beta’], [‘gamma’] But I would also like to know how often a “filtering_word” is in my string. In this case I would want to know that there

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”, “f”]. After I converted to an array, I tried

Fail to load .php files with ajax in Javascript

Instead of using jQuery here I am trying to use Javascript to load several .php files to display data from the database according to the user’s input. Below is an example of how my functions are like (and most of which are similar): and below is a screenshot of the index in the server. “sample.html” is the page for displaying

ApexCharts.exec updateSeries works only once

Have an issue that I’m trying to figure out with Apexcharts. just to lead with, I cant really post an example as the chart code is somewhat large and relies an web-sockets to get the data so I’m going to try my best to explain the flow with hopes somebody may know what I’m doing wrong here, I apologies in

SyntaxError when using try/catch with aync/await in NodeJS [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 year ago. Improve this question

Advertisement