7 kyu
Training JS #23: methods of arrayObject---push(), pop(), shift() and unshift()
2,712 of 2,711myjinxin2015
Loading description...
Fundamentals
Tutorials
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
How does parameter d work? Can anyone explain?
Isn't that explained in the Task part?
What's wrong with the completions counter? 2,467 of 2,466.
Someone did
totals.pop()
.Fixed and sample tests should have cases when
n
exceeds the bound of the array (i.e, longer than the given array's length)Nice kata. Strange how so many solutions look almost exactly the same :)
cool kata!
Very nice kyu. A little reminder about array methods.
JS: Node v14 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this
i thought there would be more than 3 arrays as a test check , but no. good task
Thought this was pretty challenging! Are us beginners meant to know what a 1D and 2D array is? I haven't seen them mentioned before in this training series.
Just a note. It seems to me that the most popular solutions don't take into consideration that the numbers can be shifted for a lot more than a couple places. Try out the performance of:
infiniteLoop([[1, 2],[3, 4, 5, 6],[7, 8, 9, 10]], "left", 2000);
Thanks, @myjinxin2015 for this kata!
I think this kata deserves 6 kyu instead of 7
ranks can't be changed :-)
This comment has been hidden.
I'm totally don't understand your code :) But it seems not a correct way ;-) For example:
For
arr = [[1,2,3],[4,5,6],[7,8,9]], d = "left" and n = 1
, the output is[[2,3,4],[5,6,7],[8,9,1]]
. It means that all the elements inarr
shift to the left 1 step, like this:This kata just to test some usage of
push(), pop(), shift() and unshift
.I know now! Thank you VERY MUCH for answering. Your "beginner javascript kata" is helping greatly. Thanks again! :)
;-)
It was pretty hard
From easy to hard, but not too hard(most guys rank as 7kyu) ;-)
I don't know how I'm bad at algorithm but I think this kata should be 6 kyu level... :((
I agree with you, but the level of kata is not determined by the author. It depends on the average level of voting and the moderator's consideration ;-)