Character Count

Discussion in 'JavaScript' started by Tony Brar, Oct 26, 2012.

  1. #1
    Hi guys,

    Is there a javascript function for character count (of a variable)?
    If so, what is it?
    If not, how do you count characters?

    Thanks,
    Tony
     
    Solved! View solution.
    Tony Brar, Oct 26, 2012 IP
  2. #2
    In javascipt strings have length property:

    var sometext = "example";
    alert(sometext +" contains " + sometext.length + " characters");
     
    jadexe, Oct 26, 2012 IP
  3. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #3
    Oh, right! Duh!
    I forgot!

    Sorry for the stupid question.
    -Tony
     
    Tony Brar, Oct 26, 2012 IP