How to Change label text using JavaScript

HTML Code

<label id=”demo”>test</label>

there are two ways to change text
1) innerHTML

<script>
document.getElementById(‘demo’).innerHTML = ‘Hello this is demo text’;
</script>

2) innerText

<script>
document.getElementById(‘demo’).innerText = ‘Hello this is demo text’;
</script>