replace method by JS