I want to create a simple function that returns a boolean value when the word "website" appears in a specific cell. When I run the debugger, matches returns undefined.

function myFunction() {
  var url = ss.getRange(8,1).getValue().toString(); 
  var matches = url.includes("website");
  return matches; 

Why doesn't my function return a boolean value?


Your function doesn't returns a boolean because Google Apps Script doesn't support String.prototype.includes() in the same way that it doesn't support several of the additions introduced in ECMAScript 2015



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.