trois degres de fonctions, nom et prenoms avec splice

var Person = function(firstAndLast) { var microtomized = firstAndLast.split(' '); this.getFirstName = function(){return microtomized[0];}; this.getLastName = function(){return microtomized[1];}; this.getFullName = function(){return microtomized.join(' ');}; this.setFirstName = function(first){ return microtomized.splice(0,1, first); }; this.setLastName = function(last){ return microtomized.splice(1,1, last); }; this.setFullName = function(firstAndLast1){firstAndLast = firstAndLast1;}; }; var bob = new Person('Bob Ross'); bob.setFirstName("Haskell"); bob.getFirstName();

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.