how to convert a block to js