Category "javascript"

How do I filter or re/assemble and collect data-items where each of an item's many color values meets a certain condition?

I have this sample data and I wanted to filter it where the colors are less than 20 or equal to 20: const data = [ { name: "Item1", colors: { green: 8 } },

create image data in javascript

I want to create a black (or white, I really don't care the "colour") 1x1px image in javascript, I tried doing it with var img = new Image(1,1) but I don't know

Spying on property changes with Sinon

I am stubbing properties with sinon. I have trouble understanding how the related spying works. Most of the sinon spy methods seem to be related to function cal

ANgular- Is it possible to add Mat-Paginator in regular table?

I made a regular HTML table in angular, whose data comes from API. I want to add mat-paginator in it. This is my code: <table class="table" style="text-align

ajax update the status so i can see the status of instered data

I have a working a ajax call thats get data form a file and load in to database. $.ajax({ xhr: function() { // Download progress

Check duplicate value in localstorage

I want to check if a id exist in database it will just simply replace it. When i try to do that it is adding the same id. addEntry = (e,id) => { e.preventD

Jquery Repeater Execute a function before creating new row

Hi I have a form that implements jquery-repeater. Code was working fine and somehow it has stopped functioning properly. Basically I have 2 different pages 1 fo

Convert JS object to JSON string

If I defined an object in JS with: var j={"name":"binchen"}; How can I convert the object to JSON? The output string should be: '{"name":"binchen"}'

Is there a way to alert when the right cell is chosen? Javascript

I have to make this game as an assignment for school, it is a simple game you just have to choose the right cell in the table. I was wondering how i am able to

How should I add error handling to the constructURL function

I'm working on a project that is helping me to learn about JavaScript for an incoming internship that I have. In the constructURL function I'm using an if-else

How to get the time spent on a tab in Chrome? [duplicate]

I am working on a chrome extension, and I need the time spent on each tab. I'm using chrome.tabs api.

How to collect multiple message in a loop using awaitMessage?

Im trying to create a game command in which players need to guess where the cat is among a number of boxes. The basic concept was done but I somehow can't colle

Angular 7 shared service for siblings component to get data from other sibling

In my Angular 7 app I have two sibling componentns... configurator component and custom stepper component. In configurator component I have some functions that

Linting not working eslint-plugin-vue for .vue with <script src="./TheAloha.js">

If i have 3 files: TheAloha.vue, TheAloha.html, TheAloha.js, linting don't work for TheAloha.js. TheAloha.vue <template src="./TheAloha.html"></templat

Accept confirm in Webview React Native

I've a React Native app (with expo) that has a Webview that I used with injectedJavascript to go through a login an do some stuff. The thing is in one part, the

I am trying to filter on date and reduce the response and do .push to my Data array. But i get error on push cannot assign numbers to strings

This is the the data[] that I want to do push on reduce. const data = [{ 'Date': '', 'AssignedA': 0, 'ConsumedA': 0, 'AssignedB': 0, 'Co

The KeyboardAvoidingView is not behaving the way I want it to

So the code for my login screen is import { StyleSheet, Text, View, StatusBar, SafeAreaView, TextInput, ImageBackground, KeyboardAvoidingView, }

Abstract type classes/interfaces in typescript

Is it possible to have superclasses/interfaces and subclasses/implementations that depict the typing in an abstract way? Lets say you have types and following f

Markdown Double Table issue

I wrote a one javascript markdown editor. When I click twice the table, 2 tables are create. But I have some problem for that. That tables are merging. How to a

How to define Type of dynamically added global variables for Intellisense

I am defining four global variables from a forEach loop using a line similar to this: global[name] = buffer with buffer being the type from node.js and current