# Why is my javascript showing white?

**URL:** https://discourse.processing.org/t/why-is-my-javascript-showing-white/1865
**Category:** Coding Questions
**Created:** [July 17, 2018, 9:57pm UTC](https://discourse.processing.org/t/why-is-my-javascript-showing-white/1865 "2018-07-17T21:57:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)
#### Post date: [July 17, 2018, 9:57pm UTC](https://discourse.processing.org/t/why-is-my-javascript-showing-white/1865/1 "2018-07-17T21:57:06Z")

</div>

I decided to start learning javascript & made a flappy bird, but after adding the pipes my screen was white. I’m using notepad ++ javascript

here the html

```auto
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Testing</title>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.dom.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.sound.js"></script>
    <script type="text/javascript" src="sketch.js"></script>
	<script type="text/javascript" src="bird.js"></script>
	<script type="text/javascript" src="pipe.js"></script>
  </head>
  <body>
  </body>
</html>

```

here bird.js

```auto
function Bird(){
	this.y = height/2;
	this.x = 50;
	this.grav = 0.6;
	this.vel = 0;
	this.lift = -15;
	
	this.show = function() {
		fill(255);
		ellipse(this.x,this.y,32,32);
	}
	
	this.up = function(){
		this.vel += this.lift;
	}
	this.move = function(){
		this.vel += this.grav;
		this.vel *= 0.9;
		this.y += this.vel;
		if (this.y > height) {
			this.y = height;
			this.vel = 0;
		}
		if (this.y < 0) {
			this.y = 0;
			this.vel = 0;
		}
	}
}

```

here sketch.js

```auto
var bird;
var pipes = [];
function setup(){
	createCanvas(400,600);
	bird = new Bird();
	pipes.push(new Pipe());
}
function draw(){
	background(0);
	bird.show();
	bird.move();
	for (var i = 0; i < pipes.length; i++){
		pipes[i].show();
		pipes[i].update();
	}
}
function keyPressed(){
	if (key == ' '){
		bird.up();
	}
}

```

here pipes.js

```auto
function Pipe() {
	this.top = random(height/2);
	this.bottom = random(height / 2);
	this.x = width;
	this.w = 20;
	this.speed = 1;
	
	this.show = function(){
		fill(255);
		rect(this.x, 0, this.w, this.top);
		rect(this.x, height-this.bottom, this.w, this.bottom);
	}
	
	this.update(){
		this.x -= this.speed;
	}
}

```

anyone know why I see a white screen instead of my game?

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [July 17, 2018, 10:10pm UTC](https://discourse.processing.org/t/why-is-my-javascript-showing-white/1865/2 "2018-07-17T22:10:08Z")

</div>

You have an error in your JS somewhere that’s crashing your sketch.

Maybe several errors.

Open the console (F12 in Chrome) to see what errors there are.

---

<div class="post-metadata">

### Author: ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)
#### Post date: [July 17, 2018, 10:11pm UTC](https://discourse.processing.org/t/why-is-my-javascript-showing-white/1865/3 "2018-07-17T22:11:24Z")

</div>

that is the height of the window

---

<div class="post-metadata">

### Author: ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)
#### Post date: [July 17, 2018, 10:23pm UTC](https://discourse.processing.org/t/why-is-my-javascript-showing-white/1865/4 "2018-07-17T22:23:15Z")

</div>

The error was a function make I declared it wrong. Thanks for the error view
