Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

Coding Train Live 122: filter(), sort() and 2048

16.9K views
•
February 18, 2018
by
The Coding Train
YouTube video player
Coding Train Live 122: filter(), sort() and 2048

TL;DR

Demonstrating the use of map, filter, reduce, fill, and sort for a particle system in JavaScript.

Transcript

hello I am back for a second livestream session today this is the coding train on YouTube my name is Dan I had some lunch and fresh I had a lovely sweet greens bowl with some like kale and cabbage nuts delicious I've got some nice warm tea here slowing down with the caffeine and feeling the music and I'm back to talk about emptiness the void there ... Read More

Key Insights

  • 👶 Utilizing map and fill for initializing arrays and populating them with new objects.
  • âš¾ Leveraging filter to efficiently remove elements from an array based on specific conditions.
  • 😒 Demonstrating the use of reduce to calculate the centroid of particle positions.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How did the fill function work for initializing an array with limited options?

The fill function requires an array with existing spots to populate based on the provided object.

Q: What benefits does the filter function offer for removing elements based on a specific condition?

Filter allows you to selectively remove elements from an array based on a given condition, improving code readability and ease of manipulation.

Q: How did you calculate the centroid of particle positions using the reduce function?

By using the reduce function, I was able to sum up all particle positions and divide by the total number of particles to find the centroid.

Q: How did you manipulate the drawing order of particles using the sort function?

By using the sort function with a custom comparison function based on particle brightness, I was able to control the drawing order to achieve a layering effect based on particle colors.

Summary & Key Takeaways

  • Demonstrated using fill to populate an array with new particle objects using map.

  • Utilized filter to remove particles when their lifespan is finished.

  • Employed reduce to calculate the centroid of particle positions.

  • Showcased using sort based on particle color to layer particles by brightness.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from The Coding Train 📚

8.1: Fractals - The Nature of Code thumbnail
8.1: Fractals - The Nature of Code
The Coding Train
ITP/IMA Winter Show 2019 thumbnail
ITP/IMA Winter Show 2019
The Coding Train
Text Generation using Spell with Nabil Hassein thumbnail
Text Generation using Spell with Nabil Hassein
The Coding Train
Coding Challenge #116: Lissajous Curve Table thumbnail
Coding Challenge #116: Lissajous Curve Table
The Coding Train
ITP/IMA Winter Show 2018 thumbnail
ITP/IMA Winter Show 2018
The Coding Train
Classifying Poses with ml5.js Part 2 thumbnail
Classifying Poses with ml5.js Part 2
The Coding Train

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.