Skip to content

Instantly share code, notes, and snippets.

ITEMS = [ {"AVOCADO" => {:price => 3.00, :clearance => true}},
{"KALE" => {:price => 3.00,:clearance => false}},
{"BLACK_BEANS" => {:price => 2.50,:clearance => false}},
{"ALMONDS" => {:price => 9.00, :clearance => false}},
{"TEMPEH" => {:price => 3.00,:clearance => true}},
{"CHEESE" => {:price => 6.50,:clearance => false}},
{"BEER" => {:price => 13.00, :clearance => false}},
{"PEANUTBUTTER" => {:price => 3.00,:clearance => true}},
{"BEETS" => {:price => 2.50,:clearance => false}}]
[
[0] {
"CHEESE" => {
:price => 6.5,
:clearance => false,
:count => 1
}
},
[1] {
"AVOCADO" => {
[
[0] {
"BEETS" => {
:price => 2.5,
:clearance => false,
:count => 3
}
},
[1] {
"TEMPEH" => {
string1 = "arrays are mutable"
string2 = "and so are strings"
string3 = "did you know?"
array1 = [string1, string2, string1]
array1[0] << " and so are strings"
array1
array1 = [0,1,2,3,4]
array2 = array1
array1[0] = 5
array1
# => [5,1,2,3,4]
array2
# => [5,1,2,3,4]
a {
display: inline-block;
background-color: #B6B6B6;
text-align: center;
text-decoration: none;
text-transform: uppercase;
font-weight: 700;
font-size: 1.5em;
font-family: sans-serif;
color: #5D595A;
a {
margin: 3%;
display: inline-block;
padding: 10px 18px;
color: #505050;
font: bold 20px Helvetica, sans-serf;
border-radius: 9px;
text-shadow: 0 1px white;
text-transform: uppercase;
text-decoration: none;
1. 5
2. number
3. true
4. Infinity
5. NaN
6. false
7. number
8. true
9. 8
10. The variable first_name is declared. Javascript hoists the variable and instantiates it. Then the variable is initialized to "cindy"
What does the following expression return?
4 > 1;
true
What does the following expression return?
"chatty" === "chatty";
true
What does the following code evaluate to?
var first_name = function (name) {
return name;
}
first_name("bob");
--------------------------------------------------
"bob"
--------------------------------------------------