1// inside if else check
2if(Array.isArray(myVarToTest)) {
3 // myVatToTest is an array
4} else {
5 // myVarToTest is not an array
6}
1var data = ['a', 'b', 'c']
2var isArray = Array.isArray(data)
3console.log(isArray)
1var colors=["red","green","blue"];
2
3if(Array.isArray(colors)){
4 //colors is an array
5}