I want you to click on a button first to verify if the value exists in a JSON that you get from localStorage and if it does not exist, save it, but when you perform the function even if the value exists, continue adding the array. The function is:
$('#btnNP').click(function(){
if ($.trim($('#txtplayer').val())==''){
alert('Ingresa tu nombre de jugador');
$('#txtpalabra').focus();
return false;
}
var jugador =$('#txtplayer').val();
for(var i in Jugadores)
{
var con = JSON.parse(Jugadores[i]);
if(con[i].player === j){
console.log(con[i].player);
}
if(con.player == jugador){
console.log(con.player);
}
else{
var jugador_push = JSON.stringify({
"player" : jugador,
"score" : 0
});
Jugadores.push(jugador_push);
localStorage.setItem("Jugadores", JSON.stringify(Jugadores));
}
}
});