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 ...
0
votes
0answers
6 views
Selectively mapping one object to another
I'm taking an input object and returning a reduced and slightly changed object:
...
0
votes
0answers
6 views
Detect if ie10+ and edge is using inPrivate mode
This is a odd case scenario. But I would like to display a message that tells if indexedDB is not supported or if it is removed due to being in private mode (yes ie10+/edge remove indexedDB in private ...
2
votes
1answer
13 views
BlackJack in Angular
I wrote the following code in Angular as to accomplish a technical test for a UK job. My impression was that it is very neat and well object oriented. To my big surprise, they rejected it. Could ...
0
votes
1answer
12 views
Optimizing code for custom multiple div appends in Javascript
I hope you can get me out of my current predicament which involves coding style when it comes to appending many elements in a pretty flexible and typesafe way.
Now I see my code below and I feel ...
0
votes
0answers
12 views
How to implement GET and POST in Node with built-in http module
This is my basic implementation of a http get and post with node built-in http node module.
I would like to keep this module standalone (no external module ...
0
votes
0answers
6 views
Async Node.js code for getting the lottery results
The JSON I get back from a request looks like this:
If I want more results I need to pass in a range (the drawID), and loop through all the requests.
I really ...
1
vote
0answers
14 views
Number-system converter in JavaScript
I have made this app to get a bit more familiar with JavaScript and CSS.
I functionality seem to work as expected. Although I've noticed problems with the flexbox-layout in Firefox. Currently no ...
1
vote
1answer
34 views
Concat strings from Object or Array
How would you merge these two functions into a single more generic function?
...
0
votes
0answers
18 views
Optimize JavaScript chain calls [on hold]
I have the following function for bundling my JavaScript modules:
...
0
votes
1answer
25 views
Follow-up zp-Tree to represent Trees as nested arrays: 3rd (final?) revision
This is a follow-up on my previous post.
I have made modifications based on the feedback received on the previous post, hence I request a third (final?) review on the modified code if ok.
Note: ...
2
votes
1answer
39 views
Add items to a list, or update the quantity if already in the list
I have several lists that contain Part objects with a partNumber and quantity. When the user ...
2
votes
1answer
48 views
JavaScript calendar widget
I'd like to know how I can refactor my JS code for usability.
Currently my JavaScript uses some HTML to build out a simple calendar with the following functionality:
a. opens into the current month ...
6
votes
1answer
23 views
When values are pasted into a bigger range, the values should be repeated as needed to fill the range
I am currently working on a project, and I just wrote a piece of it that requires a lot of array manipulation. Given a text input I want to expand it to fill the number of rows and columns I have. I ...
1
vote
1answer
32 views
Cross browser JavaScript implementation of xhr
I wrote a small, cross browser compliant implementation of xhr requests in client JavaScript that closely follows the jQuery $.ajax() API and standards. The goal is ...
0
votes
1answer
18 views
Follow-up zp-Tree to represent Trees as nested arrays
This is a follow-up on my previous post.
I have made modifications based on the feedback received on the previous post, hence I request another review on the modified code if ok.
Note: review ...
0
votes
1answer
16 views
Loading URLs via a case statement
I have the following code which loads in a URL based on the id of a user-clicked button. I'm looking to compress it down as much as possible, and make it more modular and reusable:
...
4
votes
0answers
27 views
Passport user authentication
I'm using Passport in Node.js app to authenticate user by email and password (login) and also by token.
Email and password are used only when user is logging in. Passport local strategy generates ...
2
votes
3answers
47 views
Tag dependence approach
I need to add class is_active to all div's when I click on <div id="all-tags"> and remove class if I click again. Only ...
0
votes
1answer
24 views
A javascript equivalent for toDictionary (c#)
I made a function that should ease the making of new objects out of objects or arrays.
I extended underscore so thats why the _.
...
0
votes
1answer
24 views
Data-structure “Singly-Listed List” in JavaScript
The purpose of the data-structure is to manage person-objects.
Persons can be added at any time. But the order can't be changed afterward.
Only the deletion of a person is possible. Represents the ...
2
votes
1answer
39 views
A small custom encryption / decryption script
I have made a small script for encrypting data. Now I'm wondering how efficient it is for normal users who aren't programmers and for people who are programmers.
I mean if you don't have this script ...
1
vote
0answers
20 views
Expanding list on webpage
The below produces the output I want. Namely, it initially displays the first item on the list and the first expander link. When an expander link is clicked, it hides that link, unhides one more item ...
1
vote
1answer
38 views
zp-Tree library to represent trees as nested arrays
For my project I have rewritten a small lib for a tree structure that was inspired by wangzuo's js-tree.
The reason was largely because I prefer to work with an array structure rather than nested ...
1
vote
1answer
17 views
Custom Kit Form Validation
I have an HTML form where I need to do the following
when value of Select Box changes to initial "Not Selected" value (where values of the option is 0), I am to highlight the select box, when it's ...
2
votes
1answer
15 views
JavaScript idle managing structure
I am just getting into the world of javascript, coming from the world of classical inheritance. The following is a library I wrote to track when a webapp is idling and I wrote it like I write ...
0
votes
0answers
24 views
1
vote
3answers
76 views
Get part of element ID
I am getting the number part of the container ID that the button is in. Now I am wondering if I need to create an array using split and then put this number in a ...
1
vote
0answers
26 views
JavaScript drag-and-drop sortable list
I made a simple list with drag and drop ordering function using JavaScript, HTML and CSS. Although I tried to do this as efficient as possible, I'm sure there are some improvements to be made.
What ...
0
votes
0answers
21 views
large shipping form
I made a form for shipping calculator. I used backboneJS. as a result the user sees a modal window with the entered data
https://jsfiddle.net/9t1cwfrv/7/
...
3
votes
0answers
66 views
FizzBuzz… with style (js, jquery, html, css) (and questions…)
I discovered the FizzBuzz test while looking up something else on stackoverflow, so I decided to try it and see what I would come up with. I'm kind of new to jquery and js, so I'm looking for a ...
1
vote
1answer
24 views
Creating Menubar using Angularjs 1.5
I've a sample code to create a simple menubar here which works, but I'm not sure if that's the best way to code it. Can somebody please validate if there is a better way to do the same?
In short
...
2
votes
1answer
25 views
Shipping calculator consisting of one field
A made a shipping calculator, which consists of one field that is validated.
jsFiddle
HTML:
...
0
votes
0answers
11 views
Switch call functions based on the passed parameter [closed]
I have something like this - depending on true or false I will call different methods in dataService. And then do some work with response. The only difference is the function I need to call. Is there ...
1
vote
4answers
64 views
Checking if an xy position is within a rectangular bounds
This is pretty straightforward, but is there a better way to do this?
...
2
votes
1answer
30 views
AngularJS services for APIs in large applications
I've been reading about AngularJS services and factories, and how you should strive for a thin controller, but as the project I've been working on grows it seems more and more impractical with as ...
1
vote
2answers
41 views
Finding palindromes and the longest word in a string
I have two little projects that I've been working on.
One is to find all palindromes:
...
0
votes
1answer
43 views
Bundling JavaScript resources for an MVC app
This is my first MVC app. I'm looking for best practice feedback on how to best bundle the files that I need, the order to bundle them, the placement of the @render ...
4
votes
2answers
70 views
Generating Norwegian social security numbers
I have written some code in Node.js that takes a date as argument and return all the possible combination of social security numbers.
I'd really appreciate some ...
0
votes
0answers
27 views
Animate.css 'slideshow'
Animate.css offers on it's page the possibilty to try out the included animations: https://daneden.github.io/animate.css/
For to see a demo one has to select it via a dropdown. Then trigger it by ...
3
votes
2answers
90 views
beginner TICTACTOE game for my school projet
I just wanted to know how can I code more efficiently with my project.
I'm pretty sure that all these nested "if's" can be done easier and with less code.
I made a TicTacToe game with 3 difficulty ...
2
votes
1answer
20 views
Draggable toolbar header class, inheriting from a draggable parent class
I have written a draggable parent class using a module pattern:
...
3
votes
1answer
40 views
2
votes
1answer
74 views
Learning JavaScript - calculator
I'm learning JavaScript and as a start I'm trying to create a calculator.
...
2
votes
0answers
19 views
socket.io and garbage collection
I have developed a realtime text web app using socket.io that continuously displays text on the web page. When I run my code below with multiple clients connecting the memory usage for the V8 ...
0
votes
0answers
18 views
Function that creates an object graph from database rows
Using a low-level database driver called mysql, I run a query against the database:
...
0
votes
0answers
23 views
Improving function that does an animation with JQuery .animate()
I'm a newbie with the JavaScript language. So I really appreciate any tip about how to improve my code. I'm used to code in java. Then I want to know if there is any way to abstract my function, ...
2
votes
1answer
31 views
Create a cache object in javascript
My intent is to use this object to cache data from web responses. The cache object should only be valid for the current data.
...
0
votes
0answers
32 views
Message-Div animated with changing colors
I've made this animation with jQuery and Animate.css.
Could be surely improved.
Currently I'm using 125 (5^3) different colors.
If one extends the amount of colors, or respectively the filling of ...
0
votes
1answer
16 views
Map over object values and JSON parse
Here's a small function to check if the property starts with [ or { and parse the value from a sting into JSON or an array. ...
1
vote
0answers
47 views
CRUD application using React-Redux
I am working on a React-Redux app, which is a CRUD application for a school. The first part was to implement adding/removal of classes (aliased to standard). However, the code seems unreasonably bulky ...