charAt() Estrazione di caratteri stringa




Il charAt() metodo restituisce il carattere in un indice (posizione) specificato in una stringa:

Esempio
var str = "HELLO WORLD";
str.charAt(0);

*********************************************************************
Accesso alla proprieta'
ECMAScript 5 (2009) consente l'accesso alle proprieta' [] sulle stringhe:

Esempio
var str = "HELLO WORLD";
str[0]; // returns H

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript String Methods</h2>

<p>ECMAScript 5 allows property access on strings:</p>

<p id="demo"></p>

<script>
var str = "HELLO WORLD";
document.getElementById("demo").innerHTML = str[0];
</script>
</body>
</html>










( charatestrazionedicaratteristringa.html )- by Paolo Puglisi - Modifica del 17/12/2023