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() { | |
// convert a string to a number. | |
// it uses base 10 by default | |
var foo = parseInt('78'); // 78 | |
// repeat, with a different number | |
// this time it's base 8 by default? | |
var wtf = parseInt('08'); // 0 |
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() { | |
// convert a string to a number. | |
// it uses base 10 by default | |
var foo = parseInt('78'); // 78 | |
// repeat, with a different number | |
// this time it's base 8 by default? | |
var wtf = parseInt('08'); // 0 |
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() { | |
var available_sizes = { | |
short: 2, | |
medium: 5, | |
long: 10 | |
}; | |
// in dumb browsers calling .long | |
// throws an error | |
console.log(available_sizes.long); |
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() { | |
if (true) { | |
var foo = 'apple'; | |
} | |
// foo isn't local | |
// block scope !== functional scope | |
console.log(foo); // 'apple' |
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() { | |
var sorted_array = [1,22,13,4,5].sort(function(a, b) { | |
// you get a and b to sort. | |
// if the function returns a.. | |
// negative number: a comes ahead in sort order | |
// a positive number: b comes first | |
return a-b; |
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() { | |
var sorted_array = [1,22,13,4,5].sort(function(a, b) { | |
// you get a and b to sort. | |
// if the function returns a.. | |
// negative number: a comes ahead in sort order | |
// a positive number: b comes first | |
return a-b; |
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() { | |
var sorted_array = [1,22,13,4,5].sort(); | |
console.log(sorted_array); // [1, 13, 22, 4, 5] | |
})(); |
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() { | |
var page_count = 0, | |
up_page_count = function () { | |
page_count++; | |
}; | |
if ( up_page_count() ) { | |
console.log('I will never run'); |
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
sorted_array = [1,22,13,4,5].sort(function(a, b) { | |
// you get a and b to sort. | |
// if the function returns a.. | |
// negative number: a comes ahead in sort order | |
// a positive number: b comes first | |
return a-b; | |
}); |
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
queue.subscribe do |payload| | |
begin | |
language = AlchemyApi::LanguageDetection.get_language_from_text(payload.force_encoding("UTF-8"))[:language] | |
rescue | |
end | |
p language | |
end |