window.onclick = function onclickRadio1() {
var nameRadios = document.querySelectorAll('input[name^="nameRadio"]:checked'),
results = document.querySelectorAll('[id^="result"]');
Array.prototype.forEach.call(results, function (result, index) {
result.textContent = nameRadios[index].value;
});
}
function doesParamsMatch(list, param) {
var params = Array.prototype.map.call(list, function (elem) {
return elem.getAttribute(param);
});
var result = Array.prototype.reduce.call(params, function (prev, current) {
return (prev === current) ? prev : false;
});
return result !== false;
}
var list1 = document.querySelectorAll('#true li');
var list2 = document.querySelectorAll('#false li');
console.log(doesParamsMatch(list1, 'param')); // true
console.log(doesParamsMatch(list2, 'param')); // false
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36".split(/\s/g);