Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tuyishimireeric/js-challenges
https://github.com/tuyishimireeric/js-challenges
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tuyishimireeric/js-challenges
- Owner: TuyishimireEric
- Created: 2024-01-31T06:32:34.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-02T16:19:50.000Z (12 months ago)
- Last Synced: 2025-01-09T19:49:50.512Z (17 days ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JS-Challenges
A. Basic
1. Prime numbers
Write a Javascript function that takes an array of numbers and returns a new array of prime numbers filtered from the old array.
Note: if looping is needed, use only primitive for/while/do-while loop ( forearch, map, etc are not allowed).
2. Palindrome
Write a function that takes a string and returns true/false based on whether it is a palindrome or not (you can use a dictionary to know what a palyndrom is).
3. Array reversing
Write a Javascript function that takes an array of numbers and return a reversed version
4. Inplace Array reversing
Write a Javascript function that takes an array of numbers and return a reversed version. Note: here you are not allowed to use an intermediary array. You need to use the same array passed in the parameter and just reverse its content. Do not use inbuilt functions like reverse(). Just use loops and conditions.
5. Array & Object
1. Write a function that takes a formatted array as a parameter. The array is made of a string of people’s identities in a predefined format,
“first-name second-name, age, gender” . Ex “Patrick wyne, 30, male”
[“Patrick wyne, 30, male”, “lil wyne, 32, male”,“Eric mimi, 21, female”,“Dodos deck, 21,male”,“Alian Dwine, 22, male”,“Patrick wyne, 33, male”,“Patrick wyne, 10,trans”,“Patrick wyne, 40,male”]
From the array, the function returns a nested object of two arrays: one for all females and another for all males.. Each object in the array is object with key, first-name and the corresponding child object (value) is the rest of the info, second name and age
{
females: [Eric: {second-name:mimi, age:21}],
males: [ Patrick: {second-name:wyne, age:30},lil: {second-name:wyne, age:30},Dodos:{second-name: deck, age:21}
}