Questions tagged [javascript]

JavaScript is primarily a language focused on web development. Being a monopoly on the front end and having Node on the back end. Use this tag for questions regarding vanilla JavaScript; optionally tagged with an ECMAScript version. If you are using a preprocessor such as TypeScript please tag with that too.

Filter by
Sorted by
Tagged with
1
vote
0answers
10 views

Better way to write conway's game of life

Is there a better way to write this code without using loop and if statement? It's about conway's game of life. Is it possible to solve this using reduce, forEach or map? I'm not sure how to start ...
1
vote
0answers
8 views

A component approach instead of Vue

I use Electron with NodeJS but this is mainly a javascript question. I got tired of build processes and being dependent of frameworks like Vue so I started my own. Setup in ...
-2
votes
0answers
14 views

How to get the actual text from URL not the Coding [closed]

Anyone know how to read an URL and get the actual content as text instead of the coding of the URL? Im trying to save a String from the URL to a variable. Like this prints the code of the URL... and ...
0
votes
0answers
20 views

To assign objects from array of objects to mulitple arrays in JavaScript

Suppose I have this array that contains objects: ...
-3
votes
0answers
11 views

How to add score (hits and errors [closed]

Edit** before I misused my words. Hi!! I'm new at coding. I've been trying to create a game in a battleship style, but I want to add a scoreboard, I've tried with adding parseInt and draw score ...
1
vote
0answers
22 views

SHA-256 implementation in JS (core codes)

As told by experts, I am re-posting the code review request with the code. Brief Description: from outside sha256() will be called with parameter having UTF-16 character set. then after prepareData()...
6
votes
0answers
42 views

MMMRjs a product of BYTES Genesis

Hello there, I am Syed Mohammad Sannan a team member of BYTES Genesis We have published a product today called MMMR.js this product is licensed under the MIT license and is built by Syed Mohammad ...
10
votes
3answers
473 views

Simple Calculator Script

I written my own calculator script in javascript! It is a basic one, but works really well. I am just wondering if there is any way to make this script more efficient & clean. On first look, I ...
-4
votes
0answers
19 views

Unrecognised javascript syntax [migrated]

I have come across a particular javascript code while looking into RxJs documentation. ...
-5
votes
0answers
26 views

SHA-256 implementation in JS [closed]

I know you are all kinda busy with your schedules. But I seek help to my code get verified, what is wrong with it. Could you please verify taking your free time, just for fun. Primary Language: ...
2
votes
1answer
24 views

Recursive function with Promise and setTimeout to ping DOM

I use this function in browser automation. It pings the document in the browser to check if an element we are looking for is available (useful when there is JavaScript generated async content). If it'...
-1
votes
0answers
65 views

Date convert with format, Is it performant? [closed]

I wrote my code with closure, I think this code can be more performant! I hope you help me on this code : I also concerned about readability of my code. ...
0
votes
2answers
67 views

which for loop has better performance in javascript? [closed]

I can't find out which loop is better performance than another, if you know help me. I try about loops in js and performance in this site and this is code snippet, you can run and check. ...
3
votes
2answers
60 views

Convert Exponential (e-Notation) Numbers to Decimals

I have the following short function code that converts Exponential (e-Notation) Numbers to Decimals, allowing the output of large number of decimal places. I needed to cover all the e-notation ...
2
votes
1answer
52 views

Optimizing code solution for Palindrome Index-Hackerrank

I submitted my solution for palindrome Index coding challenge but I get "test cases terminated due to time out error". My code is working and so I don't know what else to do to optimize it. Please ...
-4
votes
0answers
18 views

How to manage javascript files? [closed]

I'm using JQuery in my website, I have several views and each view has an ajax call to retrieve user info, products, and other stuff. What is the best or the more efficient way to manage javascripts ...
9
votes
2answers
248 views

Stack Overflow clone

Try It Online I have to write a simple web application using the Java Spring framework as my course project. So I decided to write a simple Stack Overflow clone. My application has the following ...
3
votes
1answer
30 views

Code Refactoring for Dynamic List in Angular 8

With a specific requirement of showing/hiding the pages, the following implementation has been carried out. The pages which needs to be hidden will be provided through an array ...
1
vote
1answer
28 views

Collapsing The Divs Using JavaScript

following is My Code for Collapsing div on Click using JavaScript It is Working Fine But i Want to Precise the onClick Function in Script Any Suggestion will Highly appreciated.Thnx In Advanced. <...
4
votes
1answer
47 views

Caesar Cipher [The Odin Project-Javascript Exercise]

Very new to coding, so please don't bully me. Implement the legendary caesar cipher: In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, ...
1
vote
0answers
15 views

User Access Authorization for Web Resources

Im refactoring a large internal legacy application and part of the stuff I want to get rid is the widespread code repetition. I'm starting with the way the website checks if a User can access a ...
2
votes
3answers
61 views

Creating accordions without using repetitive functions

I'm writing code for some accordions at the moment, using some simple vanilla JS (strictly not jQuery, has to be vanilla) and it feels like my code is really inefficient. Here it is at the moment: ...
1
vote
0answers
31 views

React/Redux/Node/Express crud application with a React class component

https://try.gitea.io/nadal/repository Used this in a coding challenge after a job interview. I didn't get chosen, but I was wondering if it was because of the code quality in the project. ...
-4
votes
0answers
20 views

javascript function to calculate second largest element in an array does not work [closed]

i am completing 10 days of javascript challenge on hackerrank and there i got this question to find the second largest element in an array and return it from the function written below. my code is ...
2
votes
2answers
37 views

String data manipulated given CSV variables

The Requirements: List the expensable items sorted by date and location given two variables: 'categories' and 'expenses'. The Categories variable provides the following information in order: Category ...
1
vote
1answer
34 views

Incrementing and decrementing 3 seperate input values by 1 using Javascript

I have written the following Javascript code which increments and decrements 3 separate inputs by 1: ...
2
votes
1answer
29 views

Getting data from database through Ajax post request

I am wondering if the method I am using to get data from a database is efficient and optimal. I have my data in MySQL database, and in my server I have a PHP file with the following code to return ...
2
votes
1answer
58 views

Learning javascript by developing a simple game

I am learning javascript and have developed a car game using : HTML Canvas javascript The repository link is : https://github.com/lazycoder-007/car_race_html_javascript_game The code is given ...
1
vote
0answers
15 views

React: Live DOM element position/dimension resolver hook optimization

I implemented the following react hook to get live updates of an element's position and dimensions in the DOM: ...
1
vote
1answer
16 views

Javascript: Mapping combinations of input and possible suffix arrays leads to repetitive if statements

I am writing a program to combine the basic form of a word with suffix arrays following the choices from a form group (Angular 9) to receive the declination. This is the flow: The user inputs a word....
1
vote
0answers
15 views

Custom react dropdown

Last night I had to build dropdown for the menu on the website that I'm working on. As I'm still React newbie I first looked if there is some package for what I'm trying to achieve but there wasn't, ...
-6
votes
0answers
24 views

Component structure in vanilla js application [closed]

Github repo url: https://github.com/himanshu206/news Tried to write component structure in vanilla javascript Need inputs in this structuring of code Its just a dummy application ( emphasis on ...
1
vote
1answer
30 views

“Clean Architecture” design pattern with Node.JS and MongoDB

After some time poorly designing my web applications' backends (mixing database calls with the controller, etc.), I have decided to try the "Clean Architecture" approach. In this example I have a ...
3
votes
2answers
101 views

Maxcounters in JavaScript

I am trying to solve this question: MaxCounters. Solving it is straightforward, but solving it fast enough is proving very difficult. How can I improve the performance of this code? At the moment it ...
0
votes
0answers
17 views

Vue.js in legacy web application

I'm working on modernizing legacy ASP.NET WebForms site which heavily relies on doing AJAX request for client-side rendering. Without the use of vue-cli compiling <...
2
votes
1answer
52 views

Leetcode Search in Rotated Sorted Array

I was doing Search in sorted array question from leetcode Question Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become ...
2
votes
1answer
25 views

Syncing Redux state with the URI in 2020

I have a React/Redux/Router/Reselect app in which I am syncing some parts of the redux state with the URL. As an interim, hacky measure (I've only been learning how to write wepapps for about 6 months ...
2
votes
0answers
46 views

Leetcode three sum in Javascript

I was doing 3sum question on leetcode Question Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the ...
0
votes
0answers
22 views

Todo app in React.js

I've built a simple todo app using React and it's really basic. However, before I continue to implement new functionality, I would like to check if everything is alright. ...
0
votes
0answers
58 views

Best Way to DownLoad File in JS [closed]

I want to download a file in js. I am doing this with the following code, but want this code to be better. Any good suggestion will be appreciated. ...
2
votes
1answer
39 views

Javascript - Extract data from html table

I want to extract the headers data and column data (not row data) from an HTML table using JavaScript. Is this a good approach of doing it? And how can I simplify this using jQuery? ...
3
votes
1answer
85 views

Simple todo list in Javascript [closed]

I'm looking for someone to tell me how I could refactor/change/improve my JS, I'm still learning and really want my code to be the best it can be for when it comes time for me getting a job in the ...
2
votes
1answer
25 views

How can I clean up (DRY) this verbose jQuery code?

I had posted this on StackOverflow — someone pointed me here. My code is working, but it's incredibly verbose and I know that it can be made more compact. I just don't know how :-) I'm building an ...
2
votes
1answer
25 views

Creating multiple DOM buttons in JavaScript (I am not DRYing)

I am making a Tic-tac-toe game and I have the basic board but I am repeating the code and it is very badly written. I am wondering how I can use better practices to write the DOM elements that I need. ...
2
votes
1answer
23 views

Draw element border according to scroll amount

I needed to draw border element according to scroll amount. I made it work but I am not sure about optimization and performance. There may have a better way? I am open to suggestion you can see it ...
2
votes
2answers
42 views

Filtering and adding additional properties to array of objects

Hi I am working on a complex application and currently adding two additional properties to objects that match the condition and returning it back. I was able to achieve the expected output, but just ...
-1
votes
0answers
30 views

Scrape page and send user only new results

Review Wanted Application Summary The application is a simple screen scraper which is to notify the user when new items are posted. The code is run as a CRON job every ten minutes. It will scrape ...
5
votes
2answers
87 views

Delays using multiple for loops

I got this script which work perfectly but I got some delays because of this 2 for loops [i][j] is there any way to do the same ...
1
vote
0answers
26 views

Mocha chai tests

I want to have a test fail, because the email already exists, so I create duplicate@dave.com and dave@dave.com, but is there a way to do it without this? ...
0
votes
0answers
12 views

Reactjs, control list of list of input

...

1
2 3 4 5
173