Skip to content

ewdlop/Advance-Javascript-Note

Repository files navigation

const  = require('lodash');

(function() {
    // Store the original .chunk function
    const originalChunk = .chunk;

    // Override the .chunk function
    .chunk = function(array, size) {
        console.log('Custom chunk function called');
        // Custom behavior
        let result = [];
        for (let i = 0; i < array.length; i += size) {
            result.push(array.slice(i, i + size));
        }
        return result;
    };

    // Use the overridden function within this scope
    console.log(.chunk(['a', 'b', 'c', 'd'], 2));
    // Output: Custom chunk function called
    // [['a', 'b'], ['c', 'd']]

    // Restore the original function after use
    .chunk = originalChunk;
})();

y ={
  
};

y.d = function(){
  return 2;
}

console.log(y.d())

y.d = (() =>{
  
},42);

console.log(y.d)

y.d = (() => {
  
});

console.log(y.d)

y = {
  
}

y = {
  
}.d = {}

console.log(y.d)

About

No description or website provided.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published