javascript pattern study