Playgrounds
Snippets
Developers
Compiler
All
ActionScript
Ajax
AngularJS
Apache
AppleScript
ASP.NET
Bash
C
C#
C++
Coffee
CoffeeScript
ColdFusion
Command
CSS
Delphi
Django
ES6
GLSL
Grunt
Gulp
HAML
Haskell
HTML
iOS
Jade
Java
JavaScript
jQuery
JSX
Less
LUA
MDX
MySQL
Objective
Other
Pascal
Perl
PHP
Plain text
PowerShell
Processing
Progress
Prolog
Pseudocode
Python
Rails
RegExr
Ruby
SASS
Scala
Scheme
SCSS
SmallBASIC
Smarty
SQL
Stylus
SVG
Swift
TypeScript
VHDL
X++
XHTML
XML
Xojo
XSLT
New snippet
New playground
Sign up
Login
Upload
Playgrounds
Snippets
Developers
Sign up
Login
Codepad is a place for developers to share code snippets (PHP, Java, Bash, C, C++, Python and more). Create your HTML, CSS and JS Demos.
Sign up
Learn more
JavaScript snippets by Yarmo Mackenbach
Generate random hexadecimal number
JavaScript
0
2
1594
Generate random Hex color
JavaScript
5
5
4228
Bliss.JS Essential Snippets
JavaScript
0
2
1070
CSS layout debugger
JavaScript
0
2
880
Is the history API supported?
JavaScript
0
1
900
Is the local storage API supported?
JavaScript
0
0
884
Is the check validity API supported?
JavaScript
0
0
829
console.log (better IE support)
JavaScript
0
1
970
Fisher-Yates Random Shuffle Array
JavaScript
0
0
978
Get size and position relative to viewport of element
JavaScript
0
0
1080
Gamepad API
JavaScript
3
2
1944
Device Proximity Event (Firefox Only)
JavaScript
0
0
895
URLSearchParams
JavaScript
0
1
1272
Safety Pig
JavaScript
0
1
1797
Beware Pirate Comment
JavaScript
0
1
925
Optimized Scroll Event
JavaScript
0
3
1542
On Scroll Stop event
JavaScript
0
0
957
Find parent node of element via querySelector
JavaScript
0
1
985
Polyfill for object-fit: cover
JavaScript
0
2
1354