ECMAScript (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms and stand-alone interpreters / JIT engines. Use this tag for questions regarding ECMAScript 5 or 6 and its dialects / implementations: JavaScript, JScript, etc., excluding ...
3
votes
0answers
25 views
Javacript OOP calculator - Code improvements
I've been trying to learn and implement Object oriented programming in Javascript.
Please could you provide some advice and feedback on the below code. (primarily on the application of OOP, overall ...
-1
votes
0answers
15 views
Best practice in FP no direct return vs composition
I'm a little bit confused with FP. Here an example using composition:
...
2
votes
0answers
17 views
Dungeon crawler map using JavaScript
I finally made a "full dungeon crawler map" thanks to this.
The map looks great to me and I'd like to hear some useful advice from you. What I'm trying to do is to simplify my logic about 'detect ...
1
vote
0answers
10 views
Objects using jQuery to maintain a playlist of shows
This is my first attend to use OOP JavaScript in my work. I know the concepts but implemented was more complicated than I thought. Now the code is a mixture of several things (JavaScript/jQuery). The ...
0
votes
1answer
21 views
Hackerrank “Queues: A Tale of Two Stacks” Javascript Solution
Here is the original problem, and below is my solution. It's asking to implement a queue with 2 stacks, which means I cannot simply use Array.shift. I wonder what can the solution be improved? Is ...
0
votes
1answer
29 views
An algorithm that finds a sequence of numbers to fill a square grid
Given numbers 1,2,3,4,5,6,7,8 I need them to replace the x's so that each side adds up to the number in the centre.
...
2
votes
2answers
41 views
Finding the greatest common factor of a list of numbers in JavaScript
The goal of this code is to take an array of two or more positive integers and return their greatest common factor, or GCF. (This is the biggest number that can be divided into all the numbers in the ...
3
votes
1answer
26 views
Graphing a linear equation using javascript and html
I'm open to any feedback even if it's just a quick browsing over to get a quick opinion of my code.
As part of a job interview process I was given a coding challenge to complete. The challenge was ...
1
vote
0answers
37 views
ReactJs Todo List push state [migrated]
I have written the start of a todo list in reactjs and was looking to improve the functionality of how the todos are added to the state. Currently I am concat(ting) the value in put to an array which ...
0
votes
0answers
12 views
Thumbnail caption in vue.js with possibly missing fields in caption
I am using the following to output a thumbnail with text. It works fine but I don't like having the use a conditional to check every prop before outputting.
E.g. this.post.user.name would indicate "...
3
votes
1answer
58 views
Find next bigger number with same combination of digits
Please review my code for a puzzle to find next bigger number with same combination of digits.
so if the number is 156432 the next bigger number is 162345
I wrote a program which is as follows,
<...
1
vote
1answer
30 views
Hackerrank CTCI “Stacks: Balanced Brackets” Javascript Solution
Here is the original problem, and below is my solution. I wonder what can be improved? Or is there a fundamentally better algorithm out there? Thank you! My intuition is telling me that it can be more ...
4
votes
1answer
42 views
Create list of objects from an object where the key is properCase using Lodash
I'm trying to create a filtered list of objects where each object in the list has both a label and value property.
First I use .pick to select the key/value pairs ...
3
votes
1answer
48 views
Is this an efficient implementation of the Roman Numeral Converter?
Is this an efficient way to implement the Roman Numeral Converter ?
So first, I put all the digits of the parameter number into an array.
Then I loop through this array, and multiply a 10 power ...
2
votes
2answers
41 views
Enabling or disabling buttons on certain events
I need to run the following checks in two occasions:
When a certain modal is first shown or clicked,
When one of two inputs is filled.
How can I remove redundancy in the following code?
...
1
vote
3answers
59 views
0
votes
0answers
22 views
Basic JavaScript template engine using replace, match and RegExp
To practice with regular expressions, I wrote this basic template engine in JavaScript in addition to a simple test case to make sure it works correctly.
I am wondering if there is any improvements I ...
-1
votes
0answers
11 views
Jquery hide(“slow”) function is not working on a 2nd time in a div in AngularJs? [on hold]
I am using jquery hide("slow") function to hide the partiulr div 1st time the div is properly hide but after click on the 2nd time hide("slow") is not working how Do resolve this issue?
...
-1
votes
0answers
25 views
Movie rating application
Please tell me if this app meets production app requirements. What can be improved in code, naming conventions or project.
Application is similar to tinder. It gets movies from server and shows ...
0
votes
0answers
25 views
TODO using localStorage API and Vanilla JS
As an introduction to the localStorage API I decided to build a TODO list application. My DOM skills are not strong and I would appreciate any suggestions on how ...
5
votes
2answers
75 views
Letter Changes coderbyte
I've solved the problem below just would like some feedback?
The function LetterChanges(str) takes a str parameter
Replace every letter in the string with ...
1
vote
1answer
41 views
React Smart and Dumb Components separation query
I have been working on React and would like to know best practices for separating smart and dumb components.
This example is a Parent controls state, but I have put the button UI in render. Should ...
0
votes
1answer
45 views
Using a destructuring assignment on a style object to extract two members
Recently, one of my colleague decided to destructure the React-Native styles object this way:
...
0
votes
1answer
39 views
Getting path array for given value in nested Object
I'm wondering how I can improve my getPath function (I found it on SO and adjusted it to my needs - biggest change was returning an array, used to be a string).
...
-1
votes
0answers
18 views
value casting to boolean in javascript good or bad? [closed]
I am trying to figure out whether using !! is a good thing or bad if so why?
e.g
...
0
votes
1answer
20 views
Get value from an async function in Outlook Web Addin
I'm working on an Outlook Web Addin that gets the email body. So in the Office API you could get the email body in two types: Simple Text and Html.
Our requirement is to get the HTML format so this ...
5
votes
2answers
65 views
Javascript wrap text with conditions
I have to wrap my text, when it's longer then 16 characters and when there is space " " or a dash "-". Can I write it with regex or a function that is easier to read than mine below?
...
0
votes
0answers
20 views
Express/Mongoose return promise out of pre save function [on hold]
I want to ask you about this code:
...
3
votes
1answer
72 views
Hackerrank “Hash Tables: Ransom Note” Javascript Solution
Here is the original problem,
and here's my solution:
...
-1
votes
0answers
13 views
Javascript Josephus problem not working [closed]
So, I'm incredibly new to Javascript and coding in general, and I decided to create a program that would figure out would be the last person remaining in the circle in the Josephus problem given a ...
0
votes
0answers
46 views
extracting an anonymous function [closed]
CodePen
On line 19, the event listener calls an anonymous function, I'd like to break this out into it's own function, but I also think I need to be passing a 3rd argument in. possibly the padz class,...
4
votes
1answer
23 views
Individual collapsible areas with accessibility in mind
I've been learning Javascript by creating reusable individually collapsible areas (not using jQuery) and I was wondering if someone could review it and let me know if there is anything they would do ...
1
vote
1answer
26 views
Filtering an array according to 7 checkboxes in a form
I am filtering an array whenever checkboxes are checked.
...
3
votes
2answers
43 views
Creating keyboard shortcuts for highlighting elements of given classes and toggle through them
I have written a jQuery script to create keyboard shortcuts to highlight elements of a class (given to me) and toggle through them. I have created the HTML file myself, so ids and class names are all ...
-2
votes
0answers
31 views
WebGL Rendering - Matrices
I'm trying to use WebGL to render hundreds of thousands of textures in the most efficient way possible.
Currently I've reached a quite decent flow having around 20K artifacts being rendered at 100fps+...
2
votes
1answer
40 views
Create two arrays duplicate code
I wrote two functions that creates two 2 dimensional arrays, but there is a lot of duplicate code and I don't know how to split it in one function. Is it even possible? I know the rule don't repeat ...
0
votes
1answer
34 views
Converting Confluence markup to a simpler XML format
I have a code that converts one xml structure to another. I am removing unnecessary tags and replacing some temporarily. I think I have way too many replace operations and wondering if there is a way ...
0
votes
0answers
19 views
Repetitive jQuery click functions for changing multiple elements
I'm using the following code to change elements text and classes when a click event is fired. My question is: Is there a better way to go about doing this that ...
-2
votes
0answers
25 views
Feedback on JS code that uses jQuery and SharePoint JSOM [closed]
I was hoping to get some feedback on some JavaScript code which I feel has gotten messy and disorganized. I am getting much better at JS but feel there might be some JS functionality that I could be ...
0
votes
0answers
15 views
Node JS that collects data, authenticates API, then post all data to an API
Introduction
First time using Code Review and appreciate all help and improvements.
I have developed code that
first gets data from a post
secondly authenticates the API connection and gets the ...
1
vote
0answers
21 views
Pomodoro Timer in pure JavaScript/CSS/HTML
I've just finished my frist project ever on GitHub and I'd like to get any opinions about it:
Is the code following a good standard?
Is there a way to improve the code to look more professional, less ...
0
votes
0answers
20 views
Shortcut finder website
This is a website and is written in angularJS, nodeJS/Express, JavaScript, HTML, CSS. With this app you can search for the keyboard shortcuts for an action you are looking for.
The full project can ...
0
votes
0answers
13 views
Simple survey application with jQuery and Bootstrap
I needed to put together a small survey / test application which consisted of a bunch of radio inputs. I decided to give the standard radio button a visual overhaul and also rethink the visual ...
0
votes
0answers
19 views
A URL Shortener with express/mongodb/nodejs
please give feedback on anything you think I could improve on. This is a URL shortener that I did from the freecodecamp challenges.
Here are some things I would like feedback on:
-My functions, do ...
2
votes
0answers
15 views
AngularJS component to display merchant offers
I am creating a web component in AngularJS which takes couple of parameters to show the information. You can check the code below:
...
3
votes
0answers
25 views
Custom Google Map plugin, am I going about this right?
i'm trying to code a Google Map plugin (well version 2 of my plugin). The code below displays the pins on the map so far, isn't finished but dont want to keep on doing it wrong if I am, it feels, ...
4
votes
1answer
59 views
Golfed Inverse Ackermann Function [closed]
The following was posted on PPCG:
Your job is to create the slowest growing function you can in no more than 100 bytes.
I did some Googling, and I was interested in the Inverse Ackermann Function:
...
3
votes
1answer
23 views
Efficiency and length of functions when perfomring similar tasks to classes and IDs
I'm not proficient at jQuery, however can tinker and get basic functionality working as I would like. The below code is performing a number of functions to change states of some elements in my site, ...
0
votes
0answers
28 views
Remove cards on click
I am using materialisedcss and angularjs for designing my website.I have series a JSON data(from Rest) which will be displayed in the form of cards as shown below.
There will be two options which ...
3
votes
1answer
23 views
lodash get method equivalent in javascript
I wanted to build similar to lodash get method. Where you put the object and key name to get value if exist. I have done this but just wanted to have more better approach. Here is what has been done ...