I am trying to get the last 5 lines from a large file using JavaScript
I've tried a lot to do it. Like this:
<script>
$.get( "myfile.txt", function(data) {
$( "#MyDiv" ).html(data.split("\n").slice(-5).join("\n"));
})
</script>
<div id="MyDiv"></div>
Which should show the contents into MyDiv
but it show them on one line.
` instead – Phiter Aug 27 '18 at 16:47