<body>
<div id="codeArea"></div>
<script>
var editor = CodeMirror(document.getElementById('codeArea'), {
lineNumbers: true,
mode: "javascript",
});
</script>
</body>
.CodeMirror {
font-size: 1em;
float: left;
width: 100%;
height: 100%;
}
.cm-wrap { height: 100% }
.cm-scroller { overflow: auto }
<div id="code" style="height: 100vh"></div>
var editor = CodeMirror(document.getElementById('code'), {mode: "javascript"});
var editorClass = document.getElementsByClassName("CodeMirror");
for(var i = 0; i < editorClass.length; i++){
editorClass[i].style.height = "100%";
}