Skip to content

Instantly share code, notes, and snippets.

View PrimeTimeTran's full-sized avatar
🎯
Focusing

Loi Tran PrimeTimeTran

🎯
Focusing
View GitHub Profile
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Todo List</title>
<meta name="description" content="Todo List">
<meta name="author" content="SitePoint">
document.getElementById("todoInput").focus()
const node = document.getElementById("todoInput");
node.addEventListener("keyup", (e) => {
if (e.key === "Enter") {
addTodo()
}
});
const todos = [
{ done: true, body: 'Go to School'},
{ done: false, body: 'Have some coffee'},
@PrimeTimeTran
PrimeTimeTran / ElCaptain.js
Last active July 29, 2019 06:28
Elcapitan
const people = [
{
id: 1,
firstName: "Loi",
lastName: "Tran",
age: 18,
favoriteColor: "red",
favoriteColors: ["red", "white", "blue"],
favoriteSingers: ["Mariah Carey", "Justin Bieber", "Britney Spears"],
nationality: "U.S.A.",
import React, { useState, useEffect } from 'react';
import './App.css';
function App() {
const [cart, setCartItem] = useState({ items: [] })
const getCart = async() => {
const cart = await localStorage.getItem('cart')
if (cart) {
const cartObject = {
export const CITIES = [
{
name: "Saigon",
latitude: 10.817141,
longitude: 106.707954,
imgUrl: [
"http://i.imgur.com/99KyJ5N.jpg",
"https://wallpapercave.com/wp/wp4190043.jpg",
"https://mfiles.alphacoders.com/701/701818.jpg",
"https://mfiles.alphacoders.com/702/702637.jpg",
[
{
"id": 1,
"first_name": "Carmelina",
"last_name": "Peasey",
"email": "[email protected]",
"gender": "Female",
"ip_address": "155.168.48.181",
"avatar_url": "https://robohash.org/necessitatibuseiusquasi.png?size=50x50&set=set1",
"last_message_content": "Curabitur at ipsum ac tellus semper interdum. Mauris ullamcorper purus sit amet nulla. Quisque arcu libero, rutrum ac, lobortis vel, dapibus at, diam.",
body {
background-color: #160507;
}
.App {
height: 95%;
width: 93vw;
margin: 10px;
display: flex;
padding: 10px;
text-align: center;
const people = [{
id: 1,
age: 18,
weight: '70kg',
followers: 200,
height: '160mm',
firstName: 'Loi',
lastName: 'Tran',
friendsCount: 100,
nationality: 'USA',
// Objectives
// Our goal with these exercises is to use arrays, objects, and the fundamental building blocks of JS to query our data
// and make new assertions. From a list of people whose attributes we have, what conclusions can be drawn?
// Hint
// 1. The most important piece of data we will work with is the people array below.
// 2. Take a moment to think about the objects in the array.
// 3. Contemplate how we could sort people based on the data we have about them.
// 4. All functions we write in this exercise will take the people array as it's only argument
// 1. Get total number of dice to be rolled.
const numberOfDice = Math.floor((Math.random() * 20))
numberOfDice // What am I?
// 2. Variables to store dice rolls sum & individual rolls.
let diceSum = 0
let diceRolls = []