JSON Stringy Method - Parameter opsional

//https://www.youtube.com/watch?v=0k4NwimfszA
// json-stringify.js
// Lesser known features when using JSON.stringify()
//Video Tutorial :https://youtu.be/0k4NwimfszA

let obj = {name: "Walter", 
           last: "Sobchak",
           age: 50, 
           angry: true, 
           bestscore: 200, 
           armed: true};
let log = console.log;
let str;

str = JSON.stringify(obj);
log('1', str);

str = JSON.stringify(obj, ['age', 'angry', 'last']);
log('\n2', str);

function replace(key, val){
    if(typeof val === 'number'){
        return undefined;
    }else{
       return val; 
    }
}
str = JSON.stringify(obj, replace);
log('\n3', str);

str = JSON.stringify(obj, null, 4);
log('\n4', str);

str = JSON.stringify(obj, null, '\tX\tX\tX\t');
log('\n5', str);
Meandering Meerkat