Skip to content

callenge.ts#26

Open
ii65ix wants to merge 3 commits intoJoinCODED:mainfrom
ii65ix:main
Open

callenge.ts#26
ii65ix wants to merge 3 commits intoJoinCODED:mainfrom
ii65ix:main

Conversation

@ii65ix
Copy link
Copy Markdown

@ii65ix ii65ix commented Jul 17, 2025

No description provided.

@shereengh
Copy link
Copy Markdown

function insertItemAtBeginning(groceries: string[], item: string): string[] {
groceries.push(item); // Add the new item to the end of the array
groceries[0] = item;
// write your code here...
return groceries;
}

You're inserting at the end of array and then returning only the first element when the task is asking you to add element to the beginning and return the whole array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants