Length function Javascript Not Working : I have simple script to display the length of a string in HTML field using Javascript. The length function which I use is not working fine. But I am unable to sort out the solution. Please advise.

 

     @foreach (var val in ViewData["Students"] as List<Students>)
        {
           var state = @val.state;  // its working fine
    		if ( (@state.length == 7))    // its not working length function fails
    		   {
                 <p> I am : @state : with length :  @state.length</p>
               }
         }