Skip to content

harini-ss-27/array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

String Array Management Script

This simple JavaScript script allows you to manage an array of strings, ensuring that each string is added only once, sorted alphabetically, and displays useful information like the current array content and its length.

Features

Prevent Duplicate Entries: Checks if a string is already in the array before adding it. Alphabetical Sorting: Automatically sorts the array alphabetically after each addition. Displays Array and Length: Prints the current state of the array and the number of elements it contains.

Technologies Used

JavaScript: Logic for managing the array, checking for duplicates, sorting, and displaying results.

How it Works

The addString(newString) function accepts a string as input. If the string is not already in the array, it gets added and the array is sorted alphabetically. If the string is a duplicate, a message is logged to indicate the string is already present in the array. After each addition, the updated array and its length are logged to the console.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published