This file contains hidden or 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
function demo(foo, bar="baz") { | |
return foo + bar; | |
} |
This file contains hidden or 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
var str = "Hello, John Doe!"; | |
var result = str.replace("John Doe", "Hein Thanth"); | |
// now result is "Hello, Hein Thanth!"; | |
var str = "Kali Linux is for Hackers. Also, Kali Linux, which is Debian based. Black Arch Linux too!"; | |
var result = str.replace("Kali Linux", "Parrot Sec OS"); |
This file contains hidden or 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
var str = "Hello, World"; | |
var result = str.slice(3, 8); | |
// result become "lo, W"; |
This file contains hidden or 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
var x = ["foo", "bar", "baz"]; | |
x = x.reverse(); | |
// now x become ["baz", "bar", "foo"]; |
This file contains hidden or 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
var x = ["ညီမလေး", "မေမေ", "ဖေဖေ", "ကိုကို"]; | |
x = x.sort(); | |
// now x become ["ကိုကို", "ညီမလေး", "ဖေဖေ", "မေမေ"]; |
This file contains hidden or 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
var x = ["c", "r", "o", "b"]; | |
x = x.sort(); | |
// now, x become ["b", "c", "o", "r"] |
This file contains hidden or 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
for(int i = 0; i < 6; i++) { | |
if(i == 3) { | |
continue; | |
} | |
// do something | |
} |
This file contains hidden or 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
<?php | |
$x = [4, 5, 6, 7, 8]; | |
foreach($x as $i) { | |
echo $i; | |
// will print 4, 5, 6, 7, 8 in each time since $i = $x[$i] in each time | |
} |
This file contains hidden or 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
var x = [4, 5, 6, 7, 8]; | |
for(var i in x) { | |
console.log(i); | |
// will log 4, 5, 6, 7, 8 in each time since i = x[i] in each time | |
} |
This file contains hidden or 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
var x = 3; | |
do { | |
// will execute once although condition is x != 3 | |
} while(x != 3); |