Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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: ...

-2
votes
0answers
15 views

Text color changes on button, but not every time [on hold]

okay, so I'm new here and maybe I'm just tired from how long this has confused me, but here we go: On a button click: When the variable "GPA" is below 2.5, the text "finalText" should turn red. When ...
3
votes
2answers
76 views

Showing a tooltip on hover based on a tooltip attribute

I'm showing a tooltip when you hover an element with the tooltip attribute. E.g. ...
1
vote
0answers
26 views

JavaScript calculator that only adds numbers

This is a JavaScript calculator that uses JQuery and bootstrap. How can I improve the CSS, HTML, JS and the general design? ...
0
votes
2answers
21 views

Map array of objects and apply condition

I'm mapping through an array of objects and applying conditions on each object by adding a new value according to the condition. I use map in ramda. Can I do this ...
0
votes
1answer
32 views
0
votes
1answer
14 views

Embolden parts of auto-complete suggestions that don't match the query

I made a function to embolden text that doesn't match a string, but it appears to be very performance-heavy. I am certain that there are much better ways to do this, but with what I tried, I ran into ...
3
votes
2answers
44 views

Simplifying Counter of Checked Checkboxes

Is the following code a proper solution to my problem? I have a feeling it can be simplified quite a bit. If one of the first four checkboxes is checked the sum is 1; if two 1.5; if three 2; if ...
0
votes
0answers
23 views

Simple code demo UI

I have a user interface that I designed for a simple code demo. The layout is presented like I want it to be, but barely holding up (malaligned components and half-baked animations). I want it ...
5
votes
0answers
49 views

Writing a new language using Jison: FreezeFlame

Reason I decided to write a new language, partially for the challange and for the following reasons: I wanted to implement the pipe operator: |>, the lambda ...
-8
votes
0answers
39 views

Write a javascript code to zoom an image from the existing image [on hold]

Please write a javascript code to zoom an image from a already existing image.I am very confused and I am working here as a fellow. Please help me to write this code and I will be expressing my ...
1
vote
1answer
16 views

BST implementation for insert and search in JavaScript

I am doing this implementation in JavaScript that I was asked to solve. I would like to get some code review. ...
1
vote
0answers
17 views

Dim Hero & Add Background to Nav on scroll

I have followed a tutorial that initially was for adding a 'sticky' nav. I adapted this slightly so it adds a background to the Nav when the page scroll reaches the top-third point of the hero area. ...
2
votes
3answers
58 views

Climbing the Leaderboard: HackerranK, Terminated due to timeout

I have implemented my solution and I thought it was pretty efficient and passes most of the cases but seems like it fails some of the test cases when the input size is very large. I basically push ...
-3
votes
0answers
40 views

Parallel computing [on hold]

Measuring the effect of Parallelization Using one of the suggested methods in class ( p-threads, OpenMP, C-Sharp or Java Threads) implement an application that adds two integer vectors (A,B) and store ...
0
votes
0answers
29 views

Two similar React Components with 90% similar code

I have a number of these components, but will show just two as an example. They're very similar, but the differences are enough to where splitting them out felt needed. What I really need is some help....
0
votes
0answers
22 views

Small “Add Contact” HTML & Vainilla JS form

So basically I developed this form with HTML, JS and Bootstrap to add contacts to a backend. It simply shows a form so a user can input some data and it's submitted to an API. The thing is it doesn't ...
-1
votes
0answers
14 views

Fall Trough switch case [on hold]

Write a program in java to accept a month number(1-12) and print the number of days in given month in the given month along with the month name by using Fall through switch case.
0
votes
0answers
39 views

How to check if quotes and parentheses are balanced [on hold]

I have been unsuccessfully trying to adapt this solution "Balanced parentheses" at Code Review SE to be able to check if the quotes and parentheses are balanced. For example this should be unbalanced ...
-3
votes
0answers
28 views

What does this 2nd line mean in JS? [on hold]

I saw this line in Jon Duckett's book of JS and JQuery. var width = 600 ; var shape = {width:300}; Is shape a structure? Or is it a local/global variable thing?
-4
votes
0answers
10 views

java application with Basic employee details [on hold]

Add basic pay as the member of all the inherit classes with 97% of BP as DA 10% of BP as HRA, 12% of BP, 0.1% of BP for staff club fund. and generate pay slips for the employees with their gross and ...
0
votes
0answers
28 views

Continuously update position of div with click event

I am trying to continuously get the position of a div on screen and update the new position each time a "click" event listener is clicked. At the moment my code works but feels redundant and could be ...
1
vote
1answer
50 views

Count number of islands 2d grid

This is a recursive approach using DFS to counting the number of islands. However, I would like to improve performance, while keeping the code clean concise and readable. Better yet can this be solved ...
-3
votes
0answers
14 views

Javascript - Unable draw on my own SVG area [on hold]

I have a trouble to know why my code is not drawing on my SVG area. When a client connected, he or she is able to connect and the x and y values of his or her drawing are sent over a server and drawn ...
0
votes
2answers
41 views

JavaScript Armstrong Number Validator (ES6)

I have the following function which takes in an input and validates if that input is an Armstrong number or not: An Armstrong Number is a number such that the sum of the cubes of its digits is ...
4
votes
2answers
39 views

Vanilla JS calculator for learning coding fundamentals

Since I am self taught, I would greatly appreciate some input on my code for this JS calculator: What redundancies i'm failing to see and remove? How is my naming for var's and functions? Is it clear ...
4
votes
1answer
37 views

Tic Tac Toe in Browser Console

Anyone remember "War games?" I have a very long way to go, but I thought it would be interesting to make a version of Tic Tac Toe which plays itself. At present the AI is "choose a random available ...
4
votes
1answer
36 views

Minimum swaps algorithm terminated due to timeout

I have been trying to solve this question. Given an unordered array consisting of consecutive integers [1, 2, 3, …, n], find the minimum number of two-element swaps to sort the array. I was able ...
-4
votes
0answers
18 views

What's the best practice for using instance properties in JS classes? [on hold]

I don't know if there is a name for classes that do most of the heavy lifting in the constructor, but I find myself using them quite often. Here is an example and some common questions that I often ...
-2
votes
0answers
19 views

Calculating percentage sales tax of an amount [on hold]

Write a function that takes an amount and calculates 6 % sales tax on the amount and return that value ...
-4
votes
0answers
15 views

Get the value of the grouping of select box and make a section visible based on the value - joget [closed]

I am wondering if you give me any advice I am trying to make a section visible based on the selectbox grouping value because in advance option I can only make it visible based on the selectbox value I ...
1
vote
0answers
15 views

Looping over an array with requestAnimationFrame

Over on SO I posted a question: Change transition duration during loop with requestAnimationFrame which hasn't got any responses just yet. I've since come up with this idea and wanted to know if there ...
1
vote
1answer
19 views

Mocha + chai tests

I have been making an effort to add a fair amount of unit testing into my code. However, I find myself going against the DRY principle quite a bit. I am currently running tests on my API with my ...
2
votes
1answer
46 views
+50

Tampermonkey script to beautify related tags in Stack Exchange

I've got the following code which is ran inside tampermonkey (It's a userscript), but there is a variable that is being declared, used, then overwritten by the next line. I'm looking for a way to ...
-5
votes
0answers
32 views

how to create stopwatch for microcontroller atmega328p [closed]

How can I create stopwatch a assembly code for Atmega328p micro controller is there any one providing this code?
1
vote
1answer
25 views

Creating smooth animations using rAF

It is my first time trying to create smooth animations using rAF and I would like some insight from more experienced developers. Basically I have 16 elements with x,y coordinates and on mousemove over ...
0
votes
0answers
28 views

Mongo async/await pattern [on hold]

I would just like to clarify if there is a difference between: ...
0
votes
1answer
35 views

Select a location on the map depending on which button is clicked

I have code like below. By default the location is myloc. When user clicks btn-a it selects ...
4
votes
2answers
38 views

Dynamic country, state select options

Here is code to dynamically choose between three country options (United States, Canada, Other). After the user selects a country it will show the related select option or an empty input (when "Other" ...
5
votes
2answers
43 views

Event emitter npm module

I was asked to complete the task described below: Event Emitters are objects that serve as the core building block in event-driven architectures. They simplify the process of handling asynchronous ...
1
vote
1answer
24 views

Building query params which append to URL in a browser

I was looking for a similar JavaScript method for http_build_query but did not find but create my own and here I am a bit confused to decide the right approach. ...
-4
votes
0answers
23 views

Passing element data to javascript based on button [closed]

i'm new to javascript and still learning. The below code works fine is just that i want to add a delete button on each new row produce. and when it's pressed it will delete the data and update the "...
1
vote
0answers
5 views

Slider that increased center slide width. (Slider plugin suggestions)

I wanted to create slider when it slide center slide width must have incresed and the two slide next to it stay on normal slide. I have tried one using slick slider. Here is the code pen link that I ...
0
votes
0answers
19 views

Fit text in a textarea with textarea or div with contenteditable

After a lot of testing I've reached this solution to fit text into an editable container with automatic height. I started with a textarea and javascript but it got extremely slow on hundreds of ...
-2
votes
0answers
17 views

Is this code compiled properly. A Revenue tracker that modifies purchases amount to cents to track [closed]

Im working on adding a revenue tracker to a site. I start a javascript courses in September so i'm still unfamiliar on the ins and outs of javascript. Currently the tracking is not working This code ...
0
votes
1answer
29 views

Manager that collects and handles multiple tasks that run on events like window.scroll, window.resize etc

I'm working on a website where different things can occur on resize and scroll events. I only want one event handler that comes ...
0
votes
1answer
17 views

Simple React component to view cached data and test result from API

This is only the front end side of things which I have at the moment, as the back end is still being worked on. But as this is my first attempt at a react component, I'd like to know if there is ...
-2
votes
0answers
25 views

isValid Function to check some conditions [closed]

This is what my isValid function does. condition1 and condition2 are false i need to return true condition1 is true then value1 should have value "a" condition2 is true then value1 should have value "...
4
votes
1answer
26 views

Enforcing numeric inputs and sanitizing different formats for IE11 input fields

I'm working on a web form that functions with numeric inputs. I have <input type="number"> input fields and with Chrome and Firefox things work nicely since ...
2
votes
2answers
65 views

Forming all multiples of 3 using the given digits

I'm working on this kata from Codewars. The task is: Given a certain number, how many multiples of three could you obtain with its digits? Supose that you have the number 362. The numbers that ...
2
votes
0answers
41 views

Register inputs (click) - write the inputs

This app register where you click on the screen, then it writes the inputs on the page. The text is responsive, you can change the dimension or orientation of the webpage and it still will be in the ...