Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [javascript]

ECMAScript or ES (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms as stand-alone interpreters or JIT compilers. Use this tag for questions regarding all versions of ES up to the current ES8 and its dialects / implementations: JavaScript, JScript, etc., excluding ActionScript.

1
vote
0answers
37 views

A CSS Browser Compatibility Checker

I am working on a program that checks for the browser support of a CSS file. Below you can find my working code, so far it supports CSS At-Rules & Properties. In the next few weeks, I will need to ...
0
votes
1answer
34 views

Swap a word in the DOM from an array of words

I have question about my code. It should swap words from an array into an HTML Element and it does so like expected. However, I was wondering about the style of my code. I would like to get some ...
2
votes
0answers
34 views

Determine if a section is in view

i am currently learning to do things with vanilla Javascript. No plugins, libraries or code snippets. I want to do things on my own, so that I understand 100% of what is happening. I wrote a little ...
0
votes
3answers
130 views

Finding nth lowest value without any Math max or min methods

So I decided to make a more efficient solution to a Google interview question where they ask you to either find the lowest or second lowest value in an array without using the max or min methods. I ...
1
vote
0answers
13 views

Load more and filtering - WordPress AJAX

In my WordPress theme I have built a function that uses Isotope Layout by Metafizzy to accomplish filtering and sorting. I have used a mix of AJAX and JQuery to accomplish this, however I feel the ...
2
votes
0answers
23 views

Vue.js Computed Property Filtering [closed]

I have a Vue.js computed property as follows. ...
2
votes
2answers
34 views

Optimized pulling items out of arrays in nested objects

I found a couple of similar questions, but they were mostly outdated. Here's the problem: create a flat array from the values in several arrays contained in several nested objects. ...
0
votes
0answers
15 views

My implementation of page navigation using react-router, babel, webpack

I have written a page navigation using nested navigation in React.js using react-router. The code can be checked out as below, ...
1
vote
1answer
51 views

Generate a Style Tag and Append to a Document

Code Review I have two functions of styleAppend and getCss, which generate and append a ...
1
vote
0answers
49 views

Angular 7 HttpClient POST and GET

I have googled and read many tutorials about fetching data and posting data to Rest API. But i have never seen a tutorial with how to handle the getting of new data after a POST or an PUT in a best ...
0
votes
0answers
29 views

Showing and hiding information with photos

I have been given an extremely loose design to follow: a page must show people's photos and name in a text overlay over the image, and when clicked a bio shows below. Must Haves Photo, text overlay ...
0
votes
0answers
25 views

Fetch the multiple images from JSON using foreach

I am fetching the images & its positions from JSON using foreach.... Is there any way i can improve code standard for performance & other things.... https://codepen.io/kidsdial/pen/EMQVqK ...
3
votes
1answer
46 views

Move and resize square boxes with Vanilla JS

Feature requirements. I can move a square box. I can resize a square box by stretching four edges. Many square boxes can exist. I've implemented moving and resizing square boxes by module pattern. ...
3
votes
1answer
35 views

Node.js http retry do while mechanism

I have implemented a simple do/while loop to handle a http request to a third-party. I don’t know when the data I receive will have elements in its array so I retry up to 10 times until the array ...
3
votes
1answer
46 views

Counting hits by domain

I wrote this algorithm which takes input data from something like a CSV file or a large array that contain a series of String elements in the format of "count, FQDN" and then adds or increments the ...
5
votes
0answers
73 views

Just a calculator

Would you review my code ? It is simple calculator made in 2/3 hours. I am still new and I was trying out some tags. If you can add some comment and say what to do and what to improve I will be really ...
1
vote
3answers
63 views

Class constructor with async properties set from poke-api

So, this is for a clicker game I'm trying to build with Pokémon data drawn from the PokéAPI. Since I'm using Vue.js for the project, ...
0
votes
0answers
35 views

jenkins deployment making the build very slow

I am new to Jenkins. I am doing a build through Jenkins, but the build is very slow. Is there any way I can speed it up? ...
0
votes
0answers
25 views

Gmail API list messages NodeJS

I use the following code to list and trash messages from the Gmail API in NodeJS. I call the getAllMessages method to get all email bodies because the Gmail API ...
2
votes
2answers
52 views

Determine if 2 javascript objects have strictly the same properties

I need to compare 2 objects to determine if they have strictly the same properties. This is what I came up with so far: ...
1
vote
2answers
70 views

JavaScript Spiral Matrix Coding Challenge

A whiteboarding challenge: Given a 2D array (matrix) inputMatrix of integers, create a function spiralCopy that copies ...
2
votes
1answer
61 views

My code get data from database using AJAX and return to view

My code get data from database using AJAX the problem is i want to filter data by month year and quarter and the code that does that is: ...
0
votes
1answer
25 views

Displaying multiple objects on map and calculating distances using google api

I am quite new to Javascript. For a school project we wrote a website that displays the user's location on a google map alongside with some objects such as vehicles or passengers. I rewrote my code ...
5
votes
4answers
269 views

Calculate Final Grade: follow-up

I'm creating an online calculator to get the average grade of different tests my students take and also the final grade. I wonder if you see any problems in my final update or any way to improve it: ...
-2
votes
1answer
39 views
0
votes
1answer
53 views

Create HTML page to document contents of directory

I often work on embedded system projects in which I have a number of documentation files, such as microprocessor datasheets, schematics, bills of materials, etc. I find it convenient to create a ...
0
votes
0answers
29 views

Self-removing modal using react portal

The goal was to use React.createPortal() to render a modal component inside a <div> other than the application root. This ...
2
votes
1answer
39 views

dc.js and crossfilter app to display multiple charts

Consider the following crossfilter / dc.js app (screenshot): ...
1
vote
1answer
32 views

React - am i overusing props or is it exactly how they are suppoused to be used?

After learning some basic concepts of ReactJs I tried to create a form. Now I'm not sure if I'm using props the way they are intented so here is sample of my relevant code: ...
1
vote
2answers
72 views

Pretty print an object - JavaScript

I've written a function to prettify a json object, as if it were using JSON.stringify. I'm only focused on strings and other objects, nothing else. Is there a better way of doing this? perhaps using ...
1
vote
1answer
44 views

JS Simple Image Slider

I'm currently learning some javascript and I've been getting up to scratch with ES6. I have learned the basics and continued to build things that I've wanted to build in Javascript for a long time. I ...
3
votes
1answer
62 views

Google Custom Search placeholder function in JavaScript

Problem: We have a Google Custom Search function that replaces the input placeholder attribute and it works okay. Would you be so kind and help me with reviewing ...
1
vote
1answer
30 views

Evaluating an arithmetic expression from a binary tree

Let's say I have a Binary Tree that looks like + 2 * 5 8 I've written a function to traverse inorder to solve it as 2+5*8 Is ...
3
votes
4answers
149 views

Calculate inputs average

I'm creating an online calculator to get the average grade of different tests my students take. I wonder if you see any problems in the following code or any way to improve it: ...
3
votes
1answer
43 views

Function to display an alert

It's a user alert script. It worked in every browser I tested. But the function itself looks very messy/repetitive. Is there any way to make this cleaner? ...
3
votes
1answer
34 views

JavaScript that deletes everything inside a folder on Box.com

I just finished a simple script for Node that will delete all the folders and files inside a specified folder ID through Box's API. It works by getting a list of items inside a folder, then generating ...
4
votes
0answers
55 views

Ship placement verification function for Battleship game

I wrote server-side Battleship game simulator in nodeJs/Javascript: A random player who begins is chosen. Both place their ships. Software recognizes if they are placed correctly. One of the players ...
2
votes
1answer
47 views

Function to filter comments and ratings, with pagination support

I have a web component that is rendering a list of items and I have this method for filtering these items based in a filterBy object that is being updated by other ...
3
votes
0answers
53 views

AJAX shopping cart with quantity +/- buttons

I'm a junior developer (couple years into it) and very new to AJAX. I'm writing an internal inventory application built on MVC and right now I'm dealing with adding and removing items to/from a cart. ...
0
votes
1answer
40 views

JavaScript - Difference between two dates in days or less [closed]

I have 2 dates that I would like to have the difference between them in days and if less than a one day simply show "less than a day". ...
5
votes
1answer
78 views

Showing events on a multi room scheduler

I write a web app that shows events on a multi room scheduler. I use VueJS for the first time on a real project. Here, I loop through the events array every room column (two nested v-for). In jQuery ...
1
vote
0answers
164 views

Deepest pit of an array

Following is based on a problem description from a Codility test, as a task in an interview. DeepestPit - problem description A non-empty zero-indexed array B ...
0
votes
0answers
15 views
4
votes
2answers
84 views

PermCheck Codility

The following code gets 100% on the PermCheck task on Codility. It should be O(N). The question is: A non-empty array A consisting of N integers is given. A permutation is a sequence ...
0
votes
1answer
34 views

Is there a better way to create constants in javascript? [closed]

Isn't there a better way to create my constants that I can use elsewhere in my code ? ...
0
votes
0answers
21 views

Generate HTML file from Handlebars template and data object

I have a class called HtmlFile which has a method called generate. The generate() method is ...
1
vote
1answer
121 views

Embedding an HTML (String) Generated from a Tree Structure JSON

How to make insertJson faster (I should keep the script compatible with old versions of IE and other browsers)? Sorry about my codes that I had to write with short ...
4
votes
1answer
70 views

JavaScript BlackJack Prototype

What would be the best way to organize BlackJack in JavaScript and maybe start with blank slate? Specific areas: Updating UI Incorporating the dealer hand into the ...
2
votes
2answers
47 views

Split an array of items into several arrays, given a condition

The question is very simple : I have an array of items, that all have a date. According to the date, I would like to split this array into several arrays. In my case, I would like to split the array ...