Convert from base 10 to base 2 without built-in base conversions Background:


  You have been given an assignment to convert base 10 numbers to base 2 without using any premade base conversion functions. You can't use any imported libraries either.


Problem:

Convert an input string from base 10 (decimal) to base 2 (binary). You may not use any premade base conversion code/functions/methods, or imported libraries. Since this is code-golf, the shortest answer in bytes will win.

Input will be anything from -32768 to 32767 (include sign byte handling in your code)
JavaScript, 46

for(x=prompt(o='');x;x&gt;&gt;&gt;=1)o=(x&amp;1)+o;alert(o)