As the guide says this and this is all you need to understand those concepts. Mdn even has the demo script which you can change and run to understand things better.
Didnt get it.
Inside the function second array loggs like [1,2,3]
Outside the function it loggs like [4,5,6]
Why?
And it continue to remain the same after function runs.
In JavaScript, function arguments are always passed by value. It means that JavaScript copies the values of the variables into the function arguments.
So changing the value(s) of the argument(s) inside the function doesn’t affect the original value.
frankenSplice([1, 2, 3], [4, 5, 6], 1);
To be clear, the values [1, 2, 3], [4, 5, 6], and 1 are considered the arguments for this function.
If you’re doing the JavaScript Algorithms and Data Structures learning path like I am, I don’t think JavaScript data types have really been in depth to this point in the curriculum.
Briefly, data types like String, Number, Boolean, Undefined and Null are all considered “primitive data types”, while Object, Function and Array are categorized as “reference data types”. When we create a variable name (also known as an identifier) and assign it data, that data is stored and accessed differently based on its data type categorization (primitive or reference).
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.