init function in js