Question from the Javascript - Fundamentals test

Use spread operator to split an array into two arrays in Javascript

Easy

What does the following code display?

let data = ["1","85","05","78", "006", "084","36"]; 
const [...vitalCard] = data; 
data = ["gender", "year","month","depart","city","civil","key"];

console.log(vitalCard); 
console.log(data);
Author: KahinaStatus: Published(Update)Question passed 3005 times
Edit
9
Community Evaluations
developer avatar
Nicolas
26/11/2023
This is an interesting question, but I'm not sure all Vanilla JS developers are used to this syntax, or are they?
developer avatar
Auteur anonyme
27/11/2023
I guess to
developer avatar
Graeme
06/07/2024
Is the syntax correct, shouldnt it be [...vitalCard], no space?
developer avatar
Auteur anonyme
19/07/2024
I agree to remove space