parseInt takes two parameters, the second one is optional. String and Radix.
String is the value to parse. If the value provided is not a string it will convert it to a string.
Radix is an integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string.
In your code snippet the Radix isn't specified and is assumed to be default 16.
var maxChars = parseInt( formField.attr('maxlength') ? formField.attr('maxlength') : counter.text() );
You are defining a variable called "maxChars". This variable is equal to the evaluation of a short hand IF statement.
You are getting the attribute from the variable which is expected to be a selector "formField" called "maxLength". The value will return as a integer, it will fallback on it's default radix.
The IF statement checks if the returned value is true or false. 0, false, ectcetera would result in the value of the variable "maxChars" to be set to "counters" combined text. IF true it would result in the variable to be set as selector "formField" attribute called "maxLength".
formField.attr('maxlength')
is there twice because one is used in an IF statement evaluation and the other is used as the value if the condition in the IF statement results as TRUE.
parseInt()
is a ternary statement which returns the maxlength if it is specified orcounter.text()
if it isn't. – Zephyrus