Skip to content
Ahmed Ayman edited this page Jul 1, 2017 · 3 revisions

Declaring JS object.

the handy way.

 var Car = {
  wheels : 4,
  engines :1,
  seats : 5
};

constructor

var Car = function() {
  this.wheels = 4;
  this.engines = 1;
  this.seats = 5;
};

var hunday = new Car(); hunday.company="hunday"

private props

var Bike = function() {
// private prop
  var gear;
  
  this.setGear = function(gearNumber){
    gear=gearNumber;
  };
  this.getGear= function(){
    return gear;
  };
};
var myBike = new Bike();

then you can pass any args to the function. say I need a custom number of wheels.

iterate over arrays

 
var oldArray = [1,2,3,4,5];
var newArray = oldArray.map(function (x){
  return x+3;
});

accumlation

//the sum of the array elements
singleVal = array.reduce(function(previous,current){
  return prev+current;
});
var oldArray = [1,2,3,4,5,6,7,8,9,10];
//creates a new array with the returned values
var newArray = oldArray.filter(function(x){
  return !(x >5); // 1 2 3 4 5
});

then it the reverse() ,concat() functions.

Free Code Camp.

Front End Development Certification

  1. HTML & CSS.
  2. Responsive web design with BootStrap.
  3. JQuery Notes.
  4. intro to JS
  5. OOP JS
  6. basic algorithm scripting.
  7. JSON API's and AJAX.

Udacity Full stack

  1. Data bases with Python.

Microsoft Professional Program

others

Clone this wiki locally