Question: Java script please ASAP! Given n>=0, create an array with the pattern {1, 1, 2, 1, 2, 3, ... 1, 2, 3 .. n} (spaces

Java script please ASAP!
Given n>=0, create an array with the pattern {1, 1, 2, 1, 2, 3, ... 1, 2, 3 .. n} (spaces added to show the grouping). Create an empty array and use push(anInt) to add new integers at the end of the array. series (3) returns [1, 1, 2, 1, 2, 3] series (4) returns [1, 1, 2, 1, 2, 3, 1, 2, 3, 4] seriesUp (2) returns [1, 1, 2] function series(n) { We'll say that a "triple" in a string is a character appearing three times in a row. Complete function countTrips to return the number of triples in the given string. This is case sensitive. The triples may overlap. countTrips ("aa") returns o Note: 'A' != 'a' countTrips ("abcXXXabc") returns 1 countTrips("xxxabyyyycd") returns 3 Note: yyyy' has two triples countTrips ("aaba") returns o function countTrips(str) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
