Convert cs to js