Skip to content

An object is in "such state" functions #2

Open
@Michaelh818

Description

@Michaelh818

An object is in "such state" functions:

  1. Come in the form of questions we can answer yes or no to. Like is the integer prime?, is the string a palindrome?, etc.
function isPrime(num) {
    for ( var i = 2; i < num; i++ ) {
      if ( num % i === 0 ) {
        return false;
      }
    }
    return true;
  }
function isPalindrome(str) {
  var strR =str.split("").reverse().join("");
  return strR === str;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions