feat: add logic

input string & target, turn into array object, sort array, output message
This commit is contained in:
afiqzudinhadi 2024-07-04 22:56:00 +08:00
parent 3029c98cd0
commit d45a1c229e
4 changed files with 47 additions and 198 deletions

34
README.md Normal file
View file

@ -0,0 +1,34 @@
# Repository Name: First Occurrence
## Description
This repository contains code and documentation related to finding the first occurrence of a specific element in a given array or string which will be sorted.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
## Installation
To use the code in this repository, you need to have [Node.js](https://nodejs.org/en) installed on your machine. Clone the repository to your local system using the following command:
```
git clone https://github.com/afiqzudinhadi/first-occurrence.git
```
Install the required dependencies by running the following command:
```
npm install
```
## Usage
1. Navigate to the repository's root directory.
2. Open terminal or command prompt.
3. Run the following command to execute the code:
```
npm run index
```
4. Follow the on-screen instructions to input the array or string and the element you want to find the first occurrence of.