Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Javascript Strings

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 252
    Comment on it

    JavaScript strings are used for storing text and manipulating it.
    A JavaScript string is used to store a series of characters like "Pranav Chhabra".
    A string can be any text inside quotes

    Example

    <!DOCTYPE html>
    <html>
    <body>
    
    <p id="ex"></p>
    
    <script>
    
    var carName1 = "swift";
    var carName2 = 'Ecco sport';
    
    document.getElementById("ex").innerHTML =
    carName1 + "<br>" + carName2; 
    
    </script>
    
    </body>
    </html>
    

    OUTPUT
    swift
    Ecco sport
    String Length
    The length of the string is determined byin the built in property length

    <p id="demo"></p>
    
    <script>
    var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    document.getElementById("demo").innerHTML = txt.length;
    </script>
    
    </body>
    </html>
    

    OUTPUT 26

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: