Right(str, n): Returns 'n' number of Characters starting from the Right of the string(towards the left) 'str'.
Note: Use "Right" and not "right"(lower case) while calling the function.
<script language="javascript" type="text/javascript">
function Right(str, n)
{
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else
{
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}
</script>
Example:alert(Right("Expertsforge", 2))
Output:ge
You can also see
Left() function in Javascript