# My javascript code not displaying on browser

**URL:** <https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687>\
**Category:** General\
**Created:** [August 28, 2020, 9:07am UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687 "2020-08-28T09:07:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hman543](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hman543/32/134853_2.png) [@hman543](https://forum.freecodecamp.org/u/hman543)\
**Post date:** [August 28, 2020, 9:07am UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/1 "2020-08-28T09:07:52Z")

</div>

I saved it as a .html file. Like it can display simple stuff, like console.log(21) , or in the past, with var products and other stuff… It is not displaying in browser.

I’m on the boolean if statement bit of javascript freecodecamp excercises…  
What’s wrong with my code.?  
Also, to space out my numbers, like my seperate bits of script, is

paragraphs advisable?

My code, il take out the script tags between them so u can see it:

```auto

document.write(21)

function testGreaterThan(val) {
  if (val > 100) {  
    return "Over 100";
  }

  if (val > 10) {  
    return "Over 10";
  }

  return "10 or Under";
}
console.log(10)

/

// stopped working .
var testArr = [1,2,3,4,5];
function nextInLine(Arr, item) {
  // Only change code below this line
Arr.push(item);
var removed = Arr.shift();
return removed;
  // Only change code above this line
  }
 <p> </p>

function equalityTest(myVal) {
  if (myVal == 10) {
     return "Equal";
  }
  return "Not Equal";
}
myVal(10);

/

// Doesn't work.
// function functionWithArgs(param1,param2) {
// console.log(param1 + param2); }
// functionWithArgs(3,1);
// document.write(functionWithArgs)

```

---

<div class="post-metadata">

**Author:** ![ArielLeslie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/arielleslie/32/264841_2.png) [@ArielLeslie](https://forum.freecodecamp.org/u/ArielLeslie)\
**Post date:** [August 28, 2020, 2:54pm UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/3 "2020-08-28T14:54:37Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](http://www.freecodecamp.com/forum/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![hman543](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hman543/32/134853_2.png) [@hman543](https://forum.freecodecamp.org/u/hman543)\
**Post date:** [August 28, 2020, 3:39pm UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/4 "2020-08-28T15:39:47Z")

</div>

thanks , but do you know why my javascript isnt correctly running and displaying the results? is it because im using notepad? on my windows laptop

```auto
cool 

```

---

<div class="post-metadata">

**Author:** ![Naomi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/naomi/32/422181_2.png) [@Naomi](https://forum.freecodecamp.org/u/Naomi)\
**Post date:** [August 28, 2020, 3:41pm UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/5 "2020-08-28T15:41:20Z")

</div>

Hello~!

To clarify, are you trying to get your JavaScript code to render something in the browser?

---

<div class="post-metadata">

**Author:** ![hman543](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hman543/32/134853_2.png) [@hman543](https://forum.freecodecamp.org/u/hman543)\
**Post date:** [August 29, 2020, 12:41pm UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/6 "2020-08-29T12:41:45Z")

</div>

Yes I am, I just want it to return stuff. Like, I have that bit of code for

```auto
myVal(10);   

```

it should return Equal., the other stuff doesn’t work either,  
the variable removed should be returned too …?

---

<div class="post-metadata">

**Author:** ![Naomi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/naomi/32/422181_2.png) [@Naomi](https://forum.freecodecamp.org/u/Naomi)\
**Post date:** [August 29, 2020, 3:16pm UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/7 "2020-08-29T15:16:58Z")

</div>

`console.log(10)` will print “10” to the _console_, but it will not render anything in the actual browser window. I apologise if I’m repeating myself, but I want to be sure I understand the objective so I don’t end up pointing you in the wrong direction.

Do you want it to print something to the browser console? Or render something in the actual view window?

---

<div class="post-metadata">

**Author:** ![hman543](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hman543/32/134853_2.png) [@hman543](https://forum.freecodecamp.org/u/hman543)\
**Post date:** [August 30, 2020, 10:51am UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/8 "2020-08-30T10:51:10Z")

</div>

Render something in the actual view window. My code should be returning the results and such.  
I didnt know there was such a place called the console,  
like code like this works and outputs 36:

```auto
<script>
var product = 6*6
document.write(product);
</script>

```

Yeah I just want to know why the webpage is blank when im opening my code in a .html page in the browser.  
Do i need script tags between each like bits of code when i introduce a new function, should i close the script tag and open up a new one?

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:41pm UTC](https://forum.freecodecamp.org/t/my-javascript-code-not-displaying-on-browser/417687/9 "2021-06-01T18:41:48Z")

</div>


