jda_m06/uf01/Exercicis UF1_2. Solucions-20211106/ex04.removeChar.html
2022-02-16 16:13:08 +01:00

26 lines
642 B
HTML
Executable file

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let text = prompt("Introduce un texto", "Este texto es de pruebaaa");
let char = prompt("Introduce un caracter", "a");
let text_rem = "";
for(let i = 0; i < text.length; i++){
if (text[i] != char){
text_rem += text[i];
}
}
alert(text_rem);
</script>
</body>
</html>