question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Challenge way to easy

See original GitHub issue

Challenge Slasher Flick has an issue. User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36. This challenge can be solved in one line of code. Is it intended that way? If yes than ok. If not, note that suggested method is actually a solution.

My code:


function slasher(arr, howMany) {
  // it doesn't always pay to be first
  var arr2 = arr.slice(howMany);
  return arr2;
}

slasher([1, 2, 3], 2);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
BKinahancommented, Jul 31, 2016

Here’s a rough idea of a frankenSplice challenge, feedback appreciated!


// Use slice() and splice() to insert the elements of the first array into the second, starting at index n of the second array.
// Optional objective: Do not mutate the input arrays.

// Solution (with optional objective)
const frankenSplice = (arr1,arr2,n) => {
    let r = arr2.slice();
    for (let i = 0; i<arr1.length; i++){
        r.splice(n+i,0,arr1[i]);
    }
    return r;
};

a = [1,2,3];
b = ["c","d","e","f"];

frankenSplice(a,b,2); // [ 'c', 'd', 1, 2, 3, 'e', 'f' ]
console.log(a); // [ 1, 2, 3 ]
console.log(b); // [ 'c', 'd', 'e', 'f' ] // Input arrays remain intact
1reaction
raisedadeadcommented, Jul 31, 2016

This is a required challenge, we can have a fair amount of toughness, at least in increment of the previous

Read more comments on GitHub >

github_iconTop Results From Across the Web

25 Simple Ways to Challenge Yourself Everyday
1. Start a book club. · 2. Change your daily route to work. · 3. Take a fitness class at your gym. ·...
Read more >
8 Steps to Create a Challenge (the Simple Way)
8 Steps to Create a Challenge (the Simple Way) · 1. Pick a challenge topic · 2. Set challenge goals · 3. Meet...
Read more >
52 Weeks Money Saving Challenge, Easy Way ... - Amazon.com
52 Weeks Money Saving Challenge, Easy Way to Save $10,000 in a Year: 120 Pages Money Savings Tracker Journal For Men And Women,Easy...
Read more >
Part 2: How to Challenge Yourself When Class Feels Too Easy
Part 2: How to Challenge Yourself When Class Feels Too Easy · My lazy pants · Idea #1. Watch the instructor less ·...
Read more >
6 Easy Ways to Challenge Your Walking Routine
Choose predetermined distances ahead of time and make those your sprints. For example, if you walk around your neighborhood, try “sprinting” ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found