Loading...
More JavaScript Posts
import { configureStore } from "@reduxjs/toolkit";import { combineReducers } from "redux";import profile from "./profile";import auth from "./auth";import alert from "./alert";const reducer = combineReducers({profile,auth,alert,});const store = configureStore({ reducer });export default store;
// There are n rings and each ring is either red, green, or blue. The rings are distributed across ten rods labeled from 0 to 9.// You are given a string rings of length 2n that describes the n rings that are placed onto the rods. Every two characters in rings forms a color-position pair that is used to describe each ring where:// The first character of the ith pair denotes the ith ring's color ('R', 'G', 'B').// The second character of the ith pair denotes the rod that the ith ring is placed on ('0' to '9').// For example, "R3G2B1" describes n == 3 rings: a red ring placed onto the rod labeled 3, a green ring placed onto the rod labeled 2, and a blue ring placed onto the rod labeled 1.// Return the number of rods that have all three colors of rings on them.let rings = "B0B6G0R6R0R6G9";var countPoints = function(rings) {let sum = 0;// Always 10 Rodsfor (let i = 0; i < 10; i++) {if (rings.includes(`B${i}`) && rings.includes(`G${i}`) && rings.includes(`R${i}`)) {sum+=1;}}return sum;};console.log(countPoints(rings));
results ={"11345240":"Media Comment-80e47004-1719-493a-af69-a43b2652b41c","11345282":"zoom_3_22_21.mp4","11345303":"Recording-2.m4a","11345348":"February 12%2C 2021.mp4","11345826":"Lecture_Rousso_Chapter_06-2.pptx","11345933":"Themes_InClassAssigment.pptx","11346193":"Agenda – Week of March23.pptx","11346318":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Bb - Score.pdf","11346319":"MUJS 2370 SP2021 Updated Rhythm Changes Drills C - Score.pdf","11346322":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Eb - Score.pdf","11346323":"MUJS 2370 Updated Rhythm Changes Drills Bass - Score.pdf","11346381":"Anthropology with colored highlighter analysis - Mar 22 2021 - 10-36 AM.pdf","11346449":"Anthropology with colored highlighter analysis - Mar 22 2021 - 10-36 AM.pdf","11346450":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Bb - Score.pdf","11346451":"MUJS 2370 SP2021 Updated Rhythm Changes Drills C - Score.pdf","11346453":"MUJS 2370 SP2021 Updated Rhythm Changes Drills Eb - Score.pdf","11346454":"MUJS 2370 Updated Rhythm Changes Drills Bass - Score.pdf","11346495":"Steinel chromatic ornamentation étude rhythm changes - Aug 23 2020 - 12-19 PM.pdf","11346532":"Media Comment-136242b4-7f2c-4d5d-8aa4-091f07e797cf","11346581":"2019 Trust Based Relationship Intervention Manual.pdf","11346584":"TBRI ppt.pptx","11346593":"Trauma informed care.ppt"}function NewTab(testing) {window.open(testing, "_blank");}for(test in results) {var testing = 'https://unt.instructure.com/files/' + test + '/download';NewTab(testing);//window.open = 'https://unt.instructure.com/files/' + test + '/download';}
class SequentialQueue{ //if you want it to go backwards, too badnext(){return this.i++;}constructor(start = 0){this.i = start;}}const que = new SequentialQueue(0);for(let i = 0; i < 10; i++){console.log(que.next());}
function formatDate(date) {return date.toLocaleDateString();}function Comment(props) {return (<div className="Comment"><div className="UserInfo"><imgclassName="Avatar"src={props.author.avatarUrl}alt={props.author.name}/><div className="UserInfo-name">{props.author.name}</div></div><div className="Comment-text">{props.text}</div><div className="Comment-date">{formatDate(props.date)}</div></div>);}const comment = {date: new Date(),text: 'I hope you enjoy learning React!',author: {name: 'Hello Kitty',avatarUrl: 'https://placekitten.com/g/64/64',},};ReactDOM.render(<Commentdate={comment.date}text={comment.text}author={comment.author}/>,document.getElementById('root'));
const flat = arr => [].concat.apply([], arr.map(a => Array.isArray(a) ? flat(a) : a));// Orconst flat = arr => arr.reduce((a, b) => Array.isArray(b) ? [...a, ...flat(b)] : [...a, b], []);// Or// See the browser compatibility at https://caniuse.com/#feat=array-flatconst flat = arr => arr.flat();// Exampleflat(['cat', ['lion', 'tiger']]); // ['cat', 'lion', 'tiger']