Check string for a character in the nth position

walden systems,  java script, javascript, strings, charat
a high-level, interpreted programming language that conforms to the ECMAScript specification. It is a language that is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm. Alongside HTML and CSS, JavaScript is one of the three core technologies of the World Wide Web.[9] JavaScript enables interactive web pages and thus is an essential part of web applications. The vast majority of websites use it,[10] and all major web browsers have a dedicated JavaScript engine to execute it.

Sometimes you might need to see if a character exists in the nth position of a string. There are many ways to accomplish this task and I would like to discuss one of the ways we are using here at Walden Systems, because we believe this is the most straightforward method to check if a character exists in the nth position of a string.

Strategy to checking if a character exists in the nth position of a string is straight forward and involves only one step: We will use is the built in JavaScript string function "charAt( pos )".


Here is the code :

if ( someChar == someString.charAt( somePosition )
{
console.log( "TRUE" ) ;
}
else
{
console.log( "FALSE" ) ;
}