JavaScript Utility Functions in Typescript

10 branches
Beginner
20 Kudos
TypeScript

Jam's Description

The addNumbers function

Before starting:

1- Install all dependencies with `pnpm install`
2- Run your tests in the terminal with `pnpm t`
3- Optionally, you can run the tests in watch mode with `npx vitest`
4

Todo

  • Implement the addNumbers function in the src/addNumbers.ts file
  • The addNumbers function takes 2 numbers as parameters, and returns the sum of these 2 values
1const x = 1;
2const y = 2;
3addNumbers(x, y); // 3
4

Important note:

You cannot modify the tests suites. If you find an issue, please, let us know via email (007@hackages.io) or via the platform.
The goal of these exercises is to teach you how to apply types on function, variables, classes and more in TypeScript.

List of content

addNumbers function
2 Kudos
addStrings function
2 Kudos
identity function
2 Kudos
first function
2 Kudos
last function
2 Kudos
isArray function
2 Kudos
isDefined function
2 Kudos
isFunction function
2 Kudos
isNumber function
2 Kudos
isDate function
2 Kudos