1. 17
    Parse a string to an integer
    3m 50s

Parse a string to an integer

Share this video with your friends

Send Tweet

A common interview question is to write
 a
function
that
converts
 a
 string
into
an
integer e.g. "123" => 123.
 This
 function 
is commonly
 called
 atoi because
 we
 are
 converting
 an
 ASCII
 string
 into 
an 
integer.

In this lesson we cover the proper way to do this in JavaScript which is parseInt along with implementing it using basic ascii math.

Francisco Mateus
~ 7 years ago

Hey Basarat! First of all Congrats, you are probably the best programmer i've seen in my life, Not just the vids but your documentation on ts is really something out of this world and it was in fact a reason for me to subscribe to egghead to see all your contents. For everyone looking for this code at github is saved as atoi.