Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
JavaScript is a versatile, high-level programming language. It is the programming language in all browsers.and can be used for back-end programming with node.js. 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.
2
votes
Accepted
Generate table of contents form HTML
First, your indentation is half-indentation. It should be four spaces instead of two. Try putting your code into JSFiddle's TidyUp function to see how to better format.
You can improve the followin …
3
votes
Auto-complete in JavaScript
There's a few things that can be reviewed:
Your indentation and spacing are incorrect, use JSFiddle's TidyUp function to clean it up.
All of the e.keyCode == matches shouldn't be matched to magic nu …
2
votes
JavaScript on page load and on scroll functions
I can't really see much to refactor in your code except a few things, so I'll go through those.
if (trigger_height == false)
could be if (!(trigger_height))
$this = $(this);
if (isScrolledI …
2
votes
Accepted
Todo List Application Code in Pure JavaScript
Ok so, your code is overall looking nice, but a few changes could be made:
It's important to make sure you leave whitespace around your operators, like:
addRecordForm.style.display="none";
…
4
votes
Accepted
Style-Changing Handler For a Select Box
Instead of testing the value of the HTML element, pass the season number in as a variable, and then you can use some of that simplifcation magic we used before:
function seasonChange() {
var sea …
2
votes
Sorting variables for human weight/length calculations
First, you've got a few errors in the following:
else if (type == 'length') {
if (s == 'f') {
if (lengthFemale.hasOwnProperty(i)) {
var m = lengthFemale[i][0 …
14
votes
Accepted
A simple JavaScript library for arrays
Description:
Library: Omega.js - Ω.js - A utility library for JavaScript programs. :)
A utility library for JavaScript programs is a bit... confusing, consider alternatives like: A utility library … for JavaScript scripts/JavaScript functions or something similar. …
1
vote
Return array of objects with matching keys
You should consider changing your function into an Object.prototype, this also removes the need for a collection parameter:
Which would then become this.
Array.prototype.where(source) {
var arr = …
3
votes
Non-generalized Site Generator
If you want to make your site builder really dynamic, you shouldn't keep the page variables inside the constructor, use an extend like function and keep them as external options.
SitePieces should no …
4
votes
Checking if a Chess space has been attacked
I would consider using a switch statement with an enum:
Looking something like this:
var PIECES = {
King: 6,
Queen: 5,
Rook: 4,
Bishop: 3,
Knight: 2,
Pawn: 1
}
switch(piece_a …
2
votes
Display characters remaining next to input/textarea
You're misusing what jQuery.noConflict does.
var jq = jQuery.noConflict();
You're using it like it creates another instance of jQuery, or something similar.
What it actually does is relinquish c …
1
vote
Correctness of a CSV writer in Node.js
There's a few points you can improve on:
throw:
throw "Object is not an Array";
You should use throw new Error instead of throw as throw new Error contains a stack trace as well.
for in:
f …
0
votes
Member-specific object cache for Angular
Your code is good, but there's a few things you should fix:
whitespace
storageMode : 'localStorage'
You have an extraneous whitespace after the keys in your objects.
In your service object, y …
2
votes
Accepted
Ionic REST + Authentication
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
…
3
votes
Badger's FizzBuzz
By traversing this, you can use the first parameter only in forEach:
Object.keys(options).forEach(function(key){
...
}
line = counter.toString(): This is JavaScript, making a variable stay in the …