

GitHub - waterlink/Challenge-Build-Your-Own-Array-In-Js: This is a challenge tha...
source link: https://github.com/waterlink/Challenge-Build-Your-Own-Array-In-Js
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Challenge “Build Your Own Array in Javascript!”
Rules are simple:
- I give you a test suite for (almost) all the functionality of the array.
- You implement that functionality in the class
MyArray
. - You can’t use standard javascript’s
Array
, instead you need to use the provided wrapperPlainArray
that limits what you can do:
class PlainArray<T> {
constructor(capacity: number)
length: number
get(index: number): T
set(index: number, value: T)
}
PlainArray
is a fixed-size array that has one property and two methods defined:length, get(index) and set(index, value)
.- Even though the definition of that class is in Typescript, you will have to use vanilla ECMA Script 5.
- Focus more on readability over the performance.
How to Run The Test Suite?
First, you’ll need to clone this repository:
$ git clone https://github.com/waterlink/Challenge-Build-Your-Own-Array-In-Js
$ cd Challenge-Build-Your-Own-Array-In-Js
You will need to open SpecRunner.html
in your browser. You can launch it from the directory in your file explorer, or you could run it from terminal:
# Mac OS X:
$ open ./SpecRunner.html
# Most Linuxes
$ xdg-open ./SpecRunner.html
You should see something like that:
To see the test suite open ./spec/MyArraySpec.js
and start making these failing tests pass one by one.
I recommend starting with the top ones, as they get harder towards the bottom.
So that you can practice your logical and problem-solving skills.
Additionally, by the end of this challenge, you’ll have much more mastery over the use of arrays in javascript.
I’m Done. Now What?
Send me a pull request to this GitHub repository. And take a look at everyone else’s solution, as well!
Just don’t peek before you are done ;)
Thank you!
</article
Recommend
-
44
The goal is to create anything you want within 1 single html file. Practice your skills with no assistance from libraries, no separat...
-
8
Let's Build Swift.Arraymikeash.com: just this guy, you know? Friday Q&A 2015-04-17: Let's Build Swift.Array by Mike Ash Swift 1.2 is now ava...
-
11
Telling your story with Dream Build Play–the $5000 developer diary challenge Dream Build Play is well under wa...
-
16
The challenge begins on May 25, 2021 at 4:00PM UTC (9:00AM PT) and ends on June 8, 2021 at 4:00PM UTC (9:00AM PT). Make sure all modules in your challenge are complete before time runs out. Play for a chance to meet one of our...
-
20
Appreciation ❤️ I'm loving every submission here on Dev.to from the previous challenges! Really thank you everyone that participated, or bookmarked it! New Challenge (Supabase version)
-
5
Build original array from the given sub-sequencesSkip to content
-
2
Lessons from Speed Build Challenge 2022
-
7
Daniel Wroblewski March 30, 2023 2 minute rea...
-
10
Build Array of length N such that exactly X Subarrays have positive sumsGiven integers N and X, the task is to construct an array of size N such that exactly X subarrays have positiv...
-
2
Dutch startup to build floating solar array at North Sea wind farm...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK