some common function in js