Skip to content

Train Driver: Prevent not following the instructions #2664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2025

Conversation

SleeplessByte
Copy link
Member

Blocks writing all the examples below:

export function fixListOfWagons(ids) {
  const firstTwo = ids.slice(0,2)
  const rest = ids.slice(2)
  return [...rest, ...firstTwo]
}

export function correctListOfWagons(ids, missingWagons) {
  const firstOne = ids.slice(0,1)
  const rest = ids.slice(1)
  return [...firstOne,...missingWagons,...rest]
}

export function correctListOfWagons(ids, missingWagons) {
  return [ids[0], ...missingWagons, ...ids.splice(1)];
}
  • slice will not be a function on the list
  • [0] will return undefined
  • console.log(missingWagons) will print List of (1,2,3) in node (and later also in web)

@SleeplessByte SleeplessByte requested a review from Cool-Katt June 10, 2025 22:47
@SleeplessByte SleeplessByte added x:action/improve Improve existing functionality/content x:module/concept-exercise Work on Concept Exercises x:type/content Work on content (e.g. exercises, concepts) labels Jun 10, 2025

This comment was marked as off-topic.

@SleeplessByte SleeplessByte changed the title Prevent not following the instructions Train Driver: Prevent not following the instructions Jun 10, 2025
@Cool-Katt Cool-Katt merged commit 486d201 into main Jun 11, 2025
10 checks passed
@Cool-Katt Cool-Katt deleted the chore/spread-limit-methods branch June 11, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/improve Improve existing functionality/content x:module/concept-exercise Work on Concept Exercises x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants