Task:
You are creating a basic calculator application. Write a TypeScript function named calculate
that takes two numbers and an operation (add, subtract, multiply, or divide) as parameters. Implement a callback function to handle the calculation and display the result.
Task:
Imagine you are building a simple quiz app. Create a TypeScript function named fetchQuestion
that returns a promise. This promise should resolve with a random quiz question (string). Use the promise to display the question when it's ready.
Task:
Build a TypeScript function named waitAndGreet
that takes a name (string) as a parameter. This function should use async/await to simulate a delay (e.g., 2 seconds) and then display a greeting with the provided name. Call this function from within an async function and log the result.
These tasks should be suitable for beginners while still covering the basics of callbacks, promises, and async/await in TypeScript.