add example design pattern with javascript