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.
Introduction to String
Is a string
Report a typo
Sample Input 1:
Sample Output 1:
true
trueWrite 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]));
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.