Is a string

Report a typo

The code below checks whether the data passed as an argument to the isString function is a string. The output of both function calls must be true, so you need to find the mistakes and correct them. If you need to enter a new value in the code, enter the string "test code". Do not change anything in the function.

Sample Input 1:

Sample Output 1:

true
true
Write a program in JavaScript
function isString(data) {
if (typeof data === 'string') {
return true;
}
else {
return false;
}
}
console.log(isString("this is a string'));
console.log(isString([10, 20, 30]));
___

Create a free account to access the full topic