Chaining

advanced7 of 10

Learn about chaining in fp-ts array

Code Editor

07-chaining.exercise.ts

💻
Loading editor...
Preparing Monaco Editor with TypeScript support

Test Results

Requirements

describe('Array chaining operations', () => {
  it('gets names of adult users', () => {
    const users = [
      { name: 'Alice', age: 25 },
      { name: 'Bob', age: 15 },
      { name: 'Charlie', age: 30 },
      { name: 'David', age: 17 },
    ]
    const result = getAdultNames(users)
    expect(result).toEqual(['Alice', 'Charlie'])
  })

  it('doubles only even numbers', () => {
    const result = doubleEvenNumbers([1, 2, 3, 4, 5, 6])
    expect(result).toEqual([4, 8, 12])
  })

  it('handles empty array', () => {
    const result = getAdultNames([])
    expect(result).toEqual([])
  })
})
🧪

Ready to Test?

Click "Run Tests" to see how your code performs

Pro Tips

💡 Stuck? Here's what to try:

  • • Read the comments in the code carefully
  • • Run tests frequently to get feedback
  • • Check the fp-ts documentation
  • • Use the solution if you need help

🚀 Learning Approach:

  • • Focus on understanding, not just solving
  • • Experiment with different approaches
  • • Think about real-world applications
  • • Build on previous exercises