Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var SpecialConsole=(function(){
- var arr=[];
- function SpecialConsole(){
- }
- SpecialConsole.prototype.writeLine=function (){
- if(arguments.length===1){
- return console.log("Message: "+arguments[0]);
- }else if(arguments.length>1){
- for (var i = 0; i < arguments.length; i++) {
- arr.push(arguments[i]);
- }
- if(arr.length%2===0){
- for (var j = 0; j < arr.length; j++) {
- if(arr[j]==='{'+ j.toString()+'}'){
- console.log(arguments[(arr.length/2)+j]);
- }else{
- break;
- }
- }
- }else{
- console.log('error')
- }
- }
- };
- return SpecialConsole;
- })();
- var specialConsole= new SpecialConsole();
- specialConsole.writeLine('Hello special console!');
- specialConsole.writeLine('{0}','{1}','pesho','nasko');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement