Created
April 13, 2013 00:56
-
-
Save gilles-leblanc/5376331 to your computer and use it in GitHub Desktop.
Strings and numbers conversions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Strings and numbers conversions | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- content to be placed inside <body>…</body> --> | |
<div id="first-result"></div> | |
<div id="second-result"></div> | |
<div id="third-result"></div> | |
<div id="fourth-result"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); | |
var x = 10; | |
// string concat with + operator | |
document.getElementById("first-result").innerHTML = x + "10"; | |
// integer addition | |
document.getElementById("second-result").innerHTML = x + 10; | |
// integer substraction | |
document.getElementById("third-result").innerHTML = 40 - x; | |
// with -, first string is converted to number | |
document.getElementById("fourth-result").innerHTML = "40" - x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment