Message from JavaScript discussions
October 2017
— So the same as integration tests
var Person = function(name) { this.name = name; };
Why should i use:
Person.prototype.getName = function() { return this.name; };
Instead of:
var Person = function(name) { this.name = name;
this.getName = function(){
return this.name;
};
};
— Why not use the new class feature from es6
class Person {
get name () {
return 'some thing'
}
}
— What if you need some sort of inhertance ?
— Why not class syntax ?
— Because in the first example you only define TWO functions, while the second example defines a function per instance you create
— Yup, prototypes don't get copied on new
— This is also cool because setting this.thing
on an object doesn't overwrite this.prototype.thing
, it just overrides it
— Well, heh
— Hey guys can anyone help me with this I came across this question want to solve it using Js..
Write a function called “getEncryptedText()” that takes a random string and generates a password out of it and another function called “getDecryptedText()” that takes the output of the “getEncryptedText()” function and returns the original string
— Ehh, what the fuck
—
var getEncryptedText = atob;
var getDecryptedText = btoa;