Computer Science basics in Javascript