This challenge is intended to utilize the JavaScript language as a means of solving a problem. However, language-specific challenges are generally discouraged on CG.
0
votes
0answers
93 views
How can I print words without using numeric/string literals? [closed]
I've been part of a set of golfs recently, where on of the constraints was, the program is not allowed to use string or numeric literals. E.g. "Hello" or 14 or [123] or var a = 0. To give you an ...
-2
votes
0answers
53 views
Build a reusable, customizable menu widget using angularjs [closed]
Build a reusable, customizable menu widget using angularjs that allows you to have as many levels as you like and is reusable in the vain of:
Sudo code:
-- ul template
ul template open
for each in ...
6
votes
4answers
373 views
Display a bézier curve in the browser
The goal is to display a bézier curve in any classical browser (except maybe old IE versions, because... are they really browsers?) client side.
Rules:
You must provide one or more files (or their ...
7
votes
2answers
174 views
Write the shortest text getter/setter on an element for the DOM
Just like jQuery's $.fn.text, write one or two functions that can get and set the text on an element.
You can't use textContent or innerText, and even less innerHTML.
Plain javascript. No DOM ...
-2
votes
1answer
93 views
IPv4 “in subnet” function [closed]
Implement the following JavaScript method as short as possible:
function same_subnet(ip_a,ip_b,sn_mask)
{
}
It should get 2 IP addresses and a subnet mask. It should return true if ip_a and ip_b ...
1
vote
10answers
503 views
Convert JSON string to Key / Value Arrays
Convert JSON (key/value pairs) to a native arrays of keys & values, in your language.
var X = '{"a":"a","b":"b","c":"c","d":"d","e":"e","f":"f9","g":"g2","h":"h1"}';
The value array could be ...
2
votes
8answers
263 views
Implement String.prototype.toLowerCase()
Implement String.prototype.toLowerCase()
Description
The toLowerCase method returns the value of the string converted to lowercase. toLowerCase does not affect the value of the string itself.
...
11
votes
12answers
1k views
Javascript: Create a 10x10 array of 1s
Obviously this challenge would be trivial with separate functions and libraries, so they aren't allowed.
Your code must conform to an ECMAscript specification (any spec will do), so no ...
-1
votes
2answers
234 views
Shortest code to check if a number is in a range in JavaScript
This is how I checkout to see if a number is in a range (in between two other numbers):
var a = 10,
b = 30,
x = 15,
y = 35;
x < Math.max(a,b) && x > Math.min(a,b) // -> ...
-1
votes
4answers
380 views
Make an HTML page goto infinite loop?
Write a code using HTML, JavaScript, jQuery to make the page go into infinite loop.
Restrictions:
No looping or control structures of javascript and jQuery allowed. You can only use alert, events, ...
11
votes
26answers
3k views
Tips for golfing in JavaScript
What general tips do you have for golfing in JavaScript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to JavaScript (e.g. "remove ...
1
vote
2answers
706 views
Smallest Javascript CSS Selector Engine
Create a small acceptably efficient JS CSS selector engine. Standard css 2.0 properties should be supported in Firefox 3.0+,Safari , Opera, IE7+, and extra brownie points for IE6 support.
Smallest ...
25
votes
2answers
2k views
What can you do in a 4k data URI?
Bounty is over, thephpdeveloper wins with Conway's Game of Life
The web platform today is advancing at a rapid rate. Features like CSS3 animations, transforms, drop shadows and gradients, ...
7
votes
4answers
7k views
Shortest URL regex match in JavaScript
Create the shortest regular expression that will roughly match a URL in text when run in JavaScript
Example:
"some text exampley.com".match(/your regular expression goes here/);
The regular ...
