let print={
str:"",
s:function(val){
if(val != undefined){print.str+=val;}
function x(){
console.log(print.str);print.str="";}
return x;},
n:function(val1){console.log(val1)},}

how to use


print.s(arg1)

.s() -> for save in same line print

arg1 -> it is what you want to save in .s() and then print


print.s()()

.s()() -> for print saved value in .s() and then it clear previus saved


print.n()

.n() -> print in nextline just like console.log()


see your console for result

See the Pen Untitled by krishna kumar (@gitkrishnaa) on CodePen.