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
const addStudent = (student) => { | |
axios.post(API_URL_BASE, student) | |
.then((response) => { | |
// What should we do when we know the post request worked? | |
const updatedData = [...studentList, response.data]; | |
setStudentList(updatedData); | |
setErrorMessage(''); | |
}) | |
.catch((error) => { | |
// What should we do when we know the post request failed? |
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
class Pet | |
attr_accessor :name | |
def initialize(name) | |
@name = name | |
end | |
def rename(new_name) | |
@name = new_name | |
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
const captainMarvel = { | |
givenName: 'Carol Danvers', | |
nickname: 'Vers', | |
age: 41, | |
sideburns: false, | |
affiliations: ["The Avengers", "S.H.I.E.L.D.", "The Starjammers"], | |
fly() { | |
console.log('zoom!'); | |
console.log('swish!'); | |
console.log('fweeee!'); |
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
const coffeePrice = function coffeePrice(isIced, size, flavorArray){ | |
let price = 2.50; | |
if(size == 0){ | |
; | |
} else if (size == 1) { | |
price += 1; | |
} else { | |
price *= 2; | |
} |
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 coffee_price is_iced, size, flavor_array | |
price = 2.50 | |
if size == 0 | |
elsif size == 1 | |
price += 1 | |
else | |
price *= 2 | |
end |