Skip to content

Instantly share code, notes, and snippets.

@Muzammil-Bilwani
Created October 15, 2018 06:41
Show Gist options
  • Save Muzammil-Bilwani/02d9c1e69a03535e5bfc74163a083c48 to your computer and use it in GitHub Desktop.
Save Muzammil-Bilwani/02d9c1e69a03535e5bfc74163a083c48 to your computer and use it in GitHub Desktop.
ES5 code
// Number 1
function greetings (name) {
return 'hello ' + name
}
// Number 2
var obj1 = { a: 1, b: 2 }
var obj2 = { a: 2, c: 3, d: 4}
var obj3 = Object.assign(obj1, obj2)
// Number 3
var obj1 = { a: 1, b: 2, c: 3, d: 4 }
var a = obj1.a
var b = obj1.b
var c = obj1.c
var d = obj1.d
// Number 4
function isGreater (a, b, cb) {
var greater = false
if(a > b) {
greater = true
}
cb(greater)
}
isGreater(1, 2, function (result) {
if(result) {
console.log('greater');
} else {
console.log('smaller')
}
})
// Number 5
var myModule = { x: 1, y: function(){ console.log('This is ES5') }}
module.exports = myModule;
// Number 6
var myModule = require('./myModule');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment