<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Diff b/w == vs ===</title>
</head>
<body>
<input type="text" id="InputValue" name="InputValue">
<button onclick="checkFunc()">Click Here</button>
<script>
function checkFunc() {
const newArray = [1,2,3,4,5,6,7,8,7,2,1,3,5,6,4,3,6,45,65,34,1,1,2,2];
let InputValue = document.getElementById('InputValue').value;
const filterValue = newArray.filter(v=>v==InputValue)
const findValue = newArray.find(v=>v==InputValue)
if(findValue===InputValue){
// Returns false since the typeof findValue is "number" and typeof InputValue is "string"
console.log('false',InputValue)
} else if(findValue==InputValue){
// Returns true since the value of both findValue and InputValue is the same
console.log('true',InputValue)
}
}
</script>
</body>
</html>