- Write down two statements using the || operator and two using the && operator.
- Verifying the return value of the statements in the Node console first, let the person next to you guess whether the four statements will evaluate to true or false.
- What does
"hello" || false
evaluate to? Why? - What does
"hello" && undefined
evaluate to? Why? - What does
"hello" && "it's me"
evaluate to? Why? - What does
"hello" || "it's me"
evaluate to? Why?
import React, { Component, PropTypes } from 'react'; | |
class SimpleAddNewForm extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { value: '' } | |
this.handleChange = () => this._handleChange(); | |
this.handleClick = () => this._handleClick(); | |
} |
{ | |
"always_show_minimap_viewport": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme", | |
"font_face": "Inconsolata", | |
"font_options": | |
[ | |
"gray_antialias" | |
], | |
"font_size": 18, |
Minitest provides some handy methods which allows us to check for falsey/truthy values and actually compare values.
assert
- The first argument passed to this method is whatever we are going to assert is truthy. For example,
assert "Hello"
returns true since"Hello"
is a truthy value. - The second argument passed to this method is an optional error message. If no argument is given, it will default to
Failed Assertion, no message given
. For example,assert nil, "Nil is falsey"
will fail, and the error message printed in the terminal will be"Nil is falsey"
.
- The first argument passed to this method is whatever we are going to assert is truthy. For example,
assert_equal
- This method takes two arguments. As the name of the method indicates, we are asserting an equality of the two given values.
refute
$(document).ready(function() { | |
renderAllItems(); | |
fetchToken(); | |
}); | |
function fetchToken() { | |
$.ajax({ | |
url: '/api/v1/env_variables.json', | |
type: 'GET', | |
success: function(response) { |
An enumerable is an object that may be enumerated. "Enumerated" means to count off the members of a set/collection/category one by one (usually in order, usually by name).
"Enumerable" is Ruby's way of saying that we can access each element in a collection, one at a time. Enumerable is a mixin in the Array class and it provides several enumerators such as each, map, select and many more. Find all enumerables and enumerators in the Ruby docs.
Ruby has a tons of enumerables which means that if we pick the right enumerable for the job, our implementation will be very clean and easy to read.
This week we are going to be writing enumerables from scratch. The groups are only allowed to use each, until loops, while loops and for loops.
// aka root component | |
var Dashboard = React.createClass({ | |
getInitialState: function() { | |
return { headerIsActive: false } | |
}, | |
onButtonClick: function() { | |
console.log('in DASHBOARD!!'); | |
}, |