1.What Is Ascii?
ASCII stands for American Standard Code for Information Interchange.
In simple words:
ASCII is a system that gives a number to every character.
Because computers don't understand letters, they only understand numbers.
name="silambu9371@gmail.com"
for(i=0;i<name.length;i++)
{
console.log(name[i]+ " = " + name.charCodeAt(i));
}
Output:
Explanation:
i = 0 → starts from first character
name.length → total number of characters
i++ → moves to next character
Gets character at position i
Example:
name[0] → 's'
name[1] → 'i'
name[2] → 'l'
name.charCodeAt(i)
Converts character → ASCII number
Example:
's' → 115
'i' → 105
'l' → 108
'a' → 97
Prints: character = ASCII value

Top comments (0)