Created
March 17, 2019 22:16
-
-
Save kinsleykajiva/4e0a3f5838c82501ede562759846f2c4 to your computer and use it in GitHub Desktop.
JS Bin Answer for http://stackoverflow.com/questions/31681732/lodash-get-duplicate-values-from-an-array // source https://jsbin.com/xizusotaca
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
<script src="https://cdn.jsdelivr.net/lodash/4/lodash.min.js"></script> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Answer for http://stackoverflow.com/questions/31681732/lodash-get-duplicate-values-from-an-array"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
"use strict"; | |
var dataset = ["A", 'null', "null"]; | |
var search = 'null'; | |
var count = dataset.reduce(function (n, val) { | |
return n + (val === search); | |
}, 0); | |
console.log(count); | |
var ischeck = ''; | |
ischeck = dataset.length - count === 1 ? 'radio' : 'check'; | |
console.log(ischeck); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
var dataset = ["A" ,'null' , "null"]; | |
var search = 'null'; | |
var count = dataset.reduce((n, val)=> { return n + (val === search);}, 0); | |
console.log(count); | |
let ischeck =''; | |
ischeck = dataset.length - count === 1 ? 'radio' : 'check' ; | |
console.log(ischeck); | |
</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
"use strict"; | |
var dataset = ["A", 'null', "null"]; | |
var search = 'null'; | |
var count = dataset.reduce(function (n, val) { | |
return n + (val === search); | |
}, 0); | |
console.log(count); | |
var ischeck = ''; | |
ischeck = dataset.length - count === 1 ? 'radio' : 'check'; | |
console.log(ischeck); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment