Array Operations

intermediate4 of 5

Learn about array operations in fp-ts pipe

Code Editor

04-array-operations.exercise.ts

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

Test Results

Requirements

describe('getAffordableInStockProductNames', () => {
  it('returns products under 100', () => {
    const result = getAffordableInStockProductNames(100)
    expect(result).toEqual(['Keyboard'])
  })

  it('returns products under 500', () => {
    const result = getAffordableInStockProductNames(500)
    expect(result).toEqual(['Keyboard', 'Monitor'])
  })

  it('returns empty array when no products match', () => {
    const result = getAffordableInStockProductNames(10)
    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