Created
June 15, 2020 07:47
-
-
Save leostaples/1b48e92cc220666e19fbe0a52279e257 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/kaweqoqore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function isLooselyEqual(left, right) { | |
return left === right || (!left && !right); | |
} | |
function passportsEqual(left, right) { | |
return ( | |
isLooselyEqual(left.home, right.home) && | |
isLooselyEqual(left.language, right.language) && | |
isLooselyEqual(left.genre, right.genre) && | |
isLooselyEqual(left.locator, right.locator) | |
); | |
} | |
const left = { | |
home: 'a', | |
language: 'b', | |
locator: 'foo', | |
} | |
const right = { | |
home: 'a', | |
language: 'b', | |
genre: null, | |
locator: 'foo', | |
} | |
console.log(passportsEqual(left, right) ); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function isLooselyEqual(left, right) { | |
return left === right || (!left && !right); | |
} | |
function passportsEqual(left, right) { | |
return ( | |
isLooselyEqual(left.home, right.home) && | |
isLooselyEqual(left.language, right.language) && | |
isLooselyEqual(left.genre, right.genre) && | |
isLooselyEqual(left.locator, right.locator) | |
); | |
} | |
const left = { | |
home: 'a', | |
language: 'b', | |
locator: 'foo', | |
} | |
const right = { | |
home: 'a', | |
language: 'b', | |
genre: null, | |
locator: 'foo', | |
} | |
console.log(passportsEqual(left, right) ); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isLooselyEqual(left, right) { | |
return left === right || (!left && !right); | |
} | |
function passportsEqual(left, right) { | |
return ( | |
isLooselyEqual(left.home, right.home) && | |
isLooselyEqual(left.language, right.language) && | |
isLooselyEqual(left.genre, right.genre) && | |
isLooselyEqual(left.locator, right.locator) | |
); | |
} | |
const left = { | |
home: 'a', | |
language: 'b', | |
locator: 'foo', | |
} | |
const right = { | |
home: 'a', | |
language: 'b', | |
genre: null, | |
locator: 'foo', | |
} | |
console.log(passportsEqual(left, right) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment