Results 1 to 2 of 2

Thread: How to make strings addable?

  1. #1

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Angry How to make strings addable?

    function Time(t1,t2){

    t = t1 + t2
    return t;
    }

    if t1 = 2, t2 = 4,

    then i get this in return: 24, instead of 6. How do i make it add instead of append?

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    function Time(t1,t2){ 
    
    t = parseInt(t1) + parseInt(t2);
    return t; 
    }
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width