DEV Community

loading...
Cover image for JavaScript Interview Question #37: What's the type of a single argument provided to the split function?

JavaScript Interview Question #37: What's the type of a single argument provided to the split function?

coderslang profile image Coderslang: Become a Software Engineer Originally published at learn.coderslang.com on ・1 min read

js-test-37

What's the output?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

In this code snipped, all the arguments provided to the function split will be collected and placed in a single array args.

The fact that we provide a single argument hello, doesn’t change the expected behavior.

As all arrays are objects in JavaScript, we’ll see the string object printed to the console.


ANSWER: the output will be object.

Learn Full-Stack JavaScript

Discussion (0)

pic
Editor guide