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

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

0
votes
0answers
8 views

First attempt at Javascript/jQuery -2 days later it works but what other ways can this be done? [on hold]

My study method is pure trial and error but the code works perfectly in the fiddle and chrome console but I feel like it's intended for front end loading when I want to permanently change the source ...
-2
votes
0answers
12 views

declaring class and passing class variable to function to input data [on hold]

Write a program that declares a class Student to store Roll No, Marks, Average and Grade of a student. Define another class marks to store the OOP, PF, Math and English. The program should define a ...
0
votes
1answer
22 views

A JavaScript-based fallback for position: sticky

This question was originally posted on Stack Overflow. You can see the before and after there, but here's the after that I'd like to bring for review here. The goal of this script is to polyfill ...
2
votes
1answer
14 views

Pomodoro Countdown Timer Synced to the Clock

This countdown timer is supposed to: be synced to the user's clock at every hour and half hour, will start a 25 minute countdown followed by a 5 minute break The code works but I question its ...
2
votes
0answers
15 views

CSV-simplified: A small open source project

I'm working on a small open source project called CSV-simplified for a course I'm taking (Bloc), and I'm looking for some feedback and potential collaborators. I don't actually know an programmers, so ...
-2
votes
0answers
9 views

JavaScript memory game extra life feature [on hold]

Come out with different logic for this. Extra life for a memory game module. ...
1
vote
0answers
34 views

Script that finds and replaces strings

I needed to do a script that finds and replace strings. The script will take a JSON config file that tells it which word to find and replace. This is what I did. I would like to know if there is a ...
2
votes
3answers
51 views

Javascript run length encoding algorithm

I have implemented a custom run length encoding algorithm that converts an m x n array into an p x (n+1) array. The extra column is to record counts. Probably easier to show through examples: <...
0
votes
1answer
20 views

Mapping properties between two Objects of different structure

Something I've found myself having to do reasonably often is map properties from an Object (usually a heavily nested MongoDB document) to a different 'shape' to then pass it to a function call or API ...
-1
votes
0answers
18 views

How to make a clock-like counting system [on hold]

I want to have a counter like that of a clock. When it reaches 60 minutes it instead goes to 00 and the hour changes. Instead it keeps counting up forever. The used code is HTML and javascript ...
0
votes
0answers
16 views

Dispatching Vuex getter via setInterval

I am fetching the friend list for a chat application using a Vuex store. I need to dispatch the getter via an interval. Is there a best practices way to do this? ...
-1
votes
0answers
22 views

Copying an immutable Array or Object [on hold]

I have a couple of functions in a javascript project that accept an object as an argument and are expected to return a copy of this object with a few changes. I'm trying to make these functions ...
1
vote
0answers
18 views

Vue Star Rating Component

I am wondering if someone can do a code re"vue" specifically for (link: https://github.com/Shreerang/Vue-Nuggets/blob/master/src/components/StarRating.vue) I am looking for feedback on best practices, ...
-6
votes
0answers
28 views

2D Character arrays from file Computer Programing homework [on hold]

Write a program that reads text from a file. Create a 2-dimensional character array that is 6 * 7. Store the characters read in your array in row major order (fill row 0 first, then row 1, etc.). Fill ...
0
votes
1answer
14 views

JS counter in DOM

I've written a function to update the contents of an HTML element to display a counter. On pageload the counter will recieve an initial value, every five minutes the new value will be requested from ...
1
vote
0answers
25 views

Javascript time series data combination

I've written code that performs a merge of two streams of sorted time series data. The first stream is taken to be the primary and any successive streams are merged into it, using the nearest ...
4
votes
2answers
330 views

Simple to-do application by an HTML beginner

I have made a simple To-Do Application just to get started with HTML/CSS/JavaScript and here is what I came up with. I have done what I can do at my best but still, I need some suggestions on my code, ...
2
votes
1answer
26 views

Plain Page Flip Effect

I've created a very plain version of page flip onscroll. I made it to look like turning the pages of a book. It looks OK on browsers I have (Firefox 52.9, Chrome 49, IE8). Though the effect doesn't ...
2
votes
1answer
36 views

O(n) Object Pool

I recently rewrote my object pool design to \$O(n)\$ complexity. I did this using a linked list, which is not native in JavaScript. It does not, unfortunately, automatically assign ...
1
vote
1answer
22 views

duplicated operator(or attribute) on the same input control - v-model and @change

I wrote a code like below - It is nuxt.js, which is one of the Vue frameworks. This code will be expected to When change event triggered, update ...
-1
votes
1answer
15 views
4
votes
1answer
43 views

JavaScript Snake: First app

I just finished my first full app in JavaScript and I'm hoping to get some feedback. I guess I'm looking for overall design advice, use of classes and functions etc. but anything is fair game so keen ...
0
votes
1answer
16 views

Uploading multiple images to Google Cloud Storage using Node.js

I am no JavaScript expert, and I have managed to hack together a node.js script that does exactly what I want it to do: upload images contained within a folder to Google Cloud Storage for a Firebase ...
0
votes
0answers
25 views

Frontend Code Challenge - Calculating Permutations

I prepared the following code for a job interview in the last few months. Unfortunately the interviewer would not provide feedback on the code itself. I'd like to get some community feedback to ensure ...
0
votes
0answers
17 views

Formatting data in array with objects

I am formatting a data result from the array of objects that looks like this: ...
1
vote
2answers
61 views

Find if cookie name exists in the cookie string

I need to find a cookie name is available or not in the cookie string. I have achieved this. We can use cookie-parser but I don't want to use the package so I have written the below code. Can I reduce ...
0
votes
0answers
16 views

Multiple div element and call it on Javascript [closed]

I suppose that if I check the checkbox, it also appears status false or true on the table. But it only appears on the first row. The second and the third row do not show the status. Why is that? How ...
-2
votes
0answers
8 views

mundane set-wise operations with objects and arrays. Good library suggestion? [closed]

The following mundane task that I use frequent enough to wonder if there is not a better way. Is a very simple package that already covers these things. Things like: Create an object that has keys: ...
0
votes
1answer
23 views

Image to HTML / CSS conversion using pure JS

Just for fun I wrote some JavaScript that "converts" an image into pure HTML / CSS. The user is able to select a local image. This image is loaded into an invisible canvas in order to extract ...
0
votes
0answers
16 views

Simple Web interface to control embedded device

I enhanced the my daughter's bed light to IoT. Specifically I can turn the light on/off remotely and there is a timer & alarm function. All of this is implemented with a Particle Photon. This ...
1
vote
1answer
23 views

Node.js configuration object based on environment variables

In the code below, I am building a NODE_ENV-sensitive config object from environment variables. ...
-4
votes
0answers
72 views

Which Pattern is Better for Checking Conditions? [closed]

In most of the methods I write, Especially methods for APIs, I have to check some conditions and then return messages. in general, I can think of two coding styles and patterns to do so. Pattern 1: ...
0
votes
0answers
40 views

Creating a table with parallel arrays

In my snippet below I've created a simple table using flat arrays, the main reason they're flat is for a slight (hopefully) performance boost since my actual data will be around 5000-10000 rows of ...
0
votes
1answer
41 views

Creating dynamic table rows

I would like to know how to make this faster. It's okay for 100 rows but 1k, 10k, 100k is different. ...
0
votes
0answers
13 views

Material UI menu drop down component

The reason I created this is because the Material UI way of doing a simple 'menu that opens below the button' is convoluted as hell (see the 'toggle menu grow' example, and check the code out. I've ...
2
votes
0answers
16 views

Jest unit test that handles a wrapped Promise

I've wrapped an imported function (a promise) and attempted to write unit tests that bring my codebase to 100% coverage. ...
0
votes
0answers
18 views

Toggle Event Delegation

NOTE: the Javascript is all I'm concerned about, the HTML/CSS is just DEMO code. One caveat is ARIA states or attributes, if you have input on that, by all means, dive in. I had the need for and ...
1
vote
0answers
37 views

Convert Javascript object-style module to functional programming [closed]

I'm working on a simple Javascript module and I'd like to make it follow the functional programming style. This module basically allows you to measure how much time has passed when you started and ...
1
vote
0answers
28 views

Recursive object/array filter by key

I have some code that takes some JSON, parses it, and given an optional filter, will attempt to find any key (or nested key) that includes the filter (partial matching - it does not match values). The ...
0
votes
0answers
10 views

Grouping by multiple items in MongoDB Shell

I'm practicing MongoDB for an upcoming job interview and came across a query that works but seem incorrect. I'm trying to find the average price and average number of manufacturers grouped by the ...
1
vote
1answer
39 views

mapping a tictactoe board in javascript

I'm creating a Tic Tac Toe solver algorithm. The idea is to iterate through each row, column and both diagonals and put them into a map in JavaScript. With that map I can run other logic to check for ...
0
votes
0answers
24 views

Find target in sorted array pivoted at some unknown point in O(log n)

You are given an array sorted in ascending order which is rotated at some pivot unknown to you beforehand. Find your target in O(log n) which means it should be a binary search. If the value does not ...
1
vote
1answer
45 views

hashtable search in JavaScript

I've implemented the search/insert part of a hashtable in JavaScript. This is in linear probing style. It resizes when the array is out of space. ...
-1
votes
0answers
10 views

Node querying 3rd party api and returning the result

The below code queries a third party api and returns the result in my node application. How can i improve this code? transaction.repository ...
1
vote
0answers
31 views

Keycloak js adapter

We are using Keycloak v4.4.0 as SSO for multiple microservices and SPAs. The main goal is to prevent user entering his credentials when landing to another SPA UI. I've not worked with such ...
0
votes
0answers
17 views

Secondary Slider

I've got the first volume slider to work for everything, but I'm trying to separate them so the lower slider controls the back loops (numbers on the right) and the upper volume slider controls the ...
0
votes
1answer
31 views

create static page with vuejs

I have a static homepage with some routes and thought about creating this with VueJs. I am totally new to this and just know NodeJs with Handlebars. So normally I would have something like this <...
3
votes
0answers
45 views

Client-side routing using Knockout and HTML5 History API for a single-page web application

The full question is... "Please, how can this code base or project (for client-side routing using Knockout and HTML5 History API) be further enhanced as regards security, production-readiness, ES6, ...
1
vote
1answer
54 views

Median of two sorted arrays JavaScript

Trying to find the median of two sorted arrays in O(log(m+n)) or better. I believe this is O(log(m+n) or O(log(m)) or O(n). ...
1
vote
1answer
8 views

Saving a submitted Mongoose model, possibly with an uploaded image

I have some code which saves a mongoose model from the submitted form data. However the user might also upload an image along with the form, which needs to be saved on the server (moved from the ...