<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>code</title> </head> <body> <script> function dec2bin(decNumber){ var stack=new stack() while(decNumber>0){ stack.push(decNumber%2) decNumber=Math.floor(decNumber/2) } var binaryString="" while(!stack.isEmpty()){ binaryString+=stack.pop() } return binaryString } </script> </body> </html>