Skip to content

Instantly share code, notes, and snippets.

body {
background-color: #fafafa;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
margin: 0;
padding: 0;
}
p {
font-family: Arial, Helvetica, sans-serif;
function getAnswer(question) {
const answer = prompt(question);
return answer;
}
function start() {
let name = getAnswer("What is your name?")
alert("Hello " + name)
name = getAnswer("What is your name?")
let animals = [
{
type: "cat",
name: "Floof",
votes: 0
},
{
type: "dog",
name: "Spot",
votes: 0
export default function Note() { // creating a function
const match = useRouteMatch(); // calling a function and saving it in a variable
const { noteId } = useParams();
const note = useSelector(state => state.notes.find(n => n.id === noteId)); // calling a function with a parameter
return ( // returning something from a function
<div className="container mt-3">
{ (!note) ? <Redirect to="/notfound"/> :
<Switch>
<Route path={`${match.path}/edit`}>
/**
* A prompt that asks a question and only allows certain answers, case insensitive
*/
class AcceptedAnswersPrompt {
constructor(question, acceptedAnswers) {
this.question = question;
this.acceptedAnswers = acceptedAnswers;
}
/**
* A prompt that asks a question and only allows certain answers, case insensitive
*/
class QuestionPrompt {
constructor(question, acceptedAnswers) {
this.question = question;
this.acceptedAnswers = acceptedAnswers;
}
getAcceptedAnswer(potentialAnswer) {
// Call the render function when the page loads in using the jquery ready function
$(function() {
renderDishList();
})
function createDish() {
// grab the stuff from the form and use that to create a new object
const dish = {
title: $("#title-input").val(),
import React, { Component } from 'react'
import PostList from './components/PostList'
export default class App extends Component {
render() {
return (
<div>
This text is in App.js
<PostList/>
body {
margin: 0;
background-color: #fafafa;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}
button {
border: 0;
padding: 15px;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Target Practice: Flexbox</title>
<link rel="stylesheet" href="target-practice-flexbox.css">
</head>
<body>