Discussion: Mortal Koncatenation
Execute the code to understand the output and gain insights into common approaches to combine two arrays in JavaScript.
We'll cover the following...
Verifying the output
Now, it’s time to execute the code and observe the output.
Press + to interact
const femaleMKCharacters = ["Sonya Blade","Sindel","Cassie Cage","Sheeva"];const maleMKCharacters = ["Scorpion","Sub-Zero","Raiden","Johnny Cage"];const MKCharacters = femaleMKCharacters + maleMKCharacters;console.log(MKCharacters);
Understanding the output
This JavaScript code defines two arrays: femaleMKCharacters
and maleMKCharacters
. The femaleMKCharacters
array contains the names of female characters from the Mortal Kombat video game series, whereas the maleMKCharacters
array ...