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
module MyModule | |
def first_module_method | |
end | |
end |
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
What does the following code print to the console? | |
var person = { | |
name: "Joe Camel", | |
age: 42, | |
status: "dead" | |
} | |
console.log(typeof person); | |
--> Object {name: "Joe Camel", age: 42, status: "dead"} | |
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
What does the following code evaluate to? | |
var first_name = function (name) { | |
return name; | |
} | |
first_name("bob"); | |
--> 'bob' | |
What does the following code evaluate to? | |
function add(x, y) { | |
return x + y; |
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
> typeof(3) | |
'number' | |
> typeof(3) === typeof(4.32) | |
true | |
> 5/0 | |
Infinity | |
> 3/"bob" | |
NaN | |
> NaN === NaN | |
false |
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
def fibo_finder | |
if n < 2 | |
n | |
else | |
fibo_finder(n-1) + fibo_finder(n-2) | |
end | |
end |
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
RSpec.configure do |config| | |
# Use color in STDOUT | |
config.color_enabled = true | |
# Use color not only in STDOUT but also in pagers and files | |
config.tty = true | |
# Use the specified formatter | |
config.formatter = :documentation # :progress, :html, :textmate | |
end |
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
9.times do |i| | |
puts i | |
end |
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(var i = 0; i < 10; i++){ | |
console.log(i); | |
} |
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
1.upto(100) do |i| | |
if i % 3 == 0 | |
puts "fizz" | |
elsif i % 5 == 0 | |
puts "buzz" | |
elsif i % 3 == 0 && i % 5 == 0 | |
puts "fizzbuzz" | |
else | |
puts i | |
end |
NewerOlder