Skip to content

Instantly share code, notes, and snippets.

@waltzaround
Created June 15, 2017 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waltzaround/2ffc8206794f5e94628a5678ae2f6493 to your computer and use it in GitHub Desktop.
Save waltzaround/2ffc8206794f5e94628a5678ae2f6493 to your computer and use it in GitHub Desktop.
var Car = function() {
// this is a private variable
var speed = 10;
// these are public methods
this.accelerate = function(change) {
speed += change;
};
this.decelerate = function() {
speed -= 5;
};
this.getSpeed = function() {
return speed;
};
};
var Bike = function(gear) {
this.gear = gear;
this.getGear = function() {
return gear;
};
this.setGear = function(potato) {
gear = potato;
};
bike.setGear(12312);
};
var myCar = new Car();
var myBike = new Bike("dfdf").getGear();\
var str = "dfdfd";
str.split('').length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment