Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.04 KB

File metadata and controls

34 lines (26 loc) · 1.04 KB

PARENTHESES VALIDATOR

[Back to Challenges]

Write a function that takes a string as its input and returns true if all parentheses, square-brackets, and curly-brackets are properly nested and closed. Otherwise the function should return false

The following string should return true

function htmlDoc(title, bodyContent) {
  return tag("html", [tag("head", [tag("title", [title])]), tag("body", bodyContent)]);
}

Each of the following strings should return false

function htmlDoc(title, bodyContent) {
  return tag("html", [tag("head", [tag("title", [title])), tag("body", bodyContent)]);
}
function htmlDoc(title, bodyContent) {
  return tag("html", [tag "head", [tag("title", [title])]), tag("body", bodyContent)]);
}
function htmlDoc(title, bodyContent) {
  return tag("html", [tag("head", [tag("title", [title]])), tag("body", bodyContent)]);
}

Stretch Goal - Write another function that identifies where the inconsistencies are.