I'm wanting to create a function that will check if an array's object matches a type array.
An example of what I'm trying to achieve is
let syntax = [Number, String];
let arguments = [23, 'some string', {some: 'ignored argument'}];
// How would I check if syntax[0] matches arguments[0] without hardcoding
// it to keep it flexible?
I want to be able to have some sort of function that'll basically check if arguments[0] matches the type on syntax[0], while also having it to be able to check more than just one, or two, and so on types (no hardcoding if (something[0] === somethingAgain[0])
), however I have no idea how to even achieve this.
Sorry if this is a loaded question! I'm fine with using third-party modules via NPM if this is a long shot.