Skip to main content

Posts

Teseart interview questions

 1)proxy,proptoype and refelect why to use when json is there? When working with JSON in JavaScript, you may come across situations where you need to manipulate objects or perform certain operations on them. Let's discuss how the concepts of Proxy, Prototype, and Reflect can be relevant when working with JSON: Proxy: The Proxy object in JavaScript allows you to create a proxy for another object, intercepting and customizing its fundamental operations. Proxies are useful when you want to add custom behaviors or validations to an object. When working with JSON, you can use a Proxy to validate or modify JSON data before or after parsing it. Example: javascript Copy code const json = '{ "name": "John", "age": 30 }'; const validator = {   set: function(target, property, value) {     if (property === 'age' && typeof value !== 'number') {       throw new Error('Age must be a number');     }     target[property] = value;...

scrumbler interview questions

 1)Settimeout in the promise let print3 = async(timeout)=>{     console.log(timeout)     return new Promise((resolve,reject)=>{         setTimeout(()=>{             console.log("3");             resolve('res');         }, timeout)     }) } print3(10000).then((res)=>{     console.log(res) }) 2)Clouser 2*8: def multiply_numbers(x):     def multiply(y):         return x * y     return multiply # Creating a closure instance for multiplying by 5 multiply_by_5 = multiply_numbers(5) # Using the closure instance to multiply a number result = multiply_by_5(7) print(result)  # Output: 35 3) In JavaScript, a higher-order function is a function that takes one or more functions as arguments and/or returns a function as its result. Here's an example to demonstrate higher-order functions in JavaScript: ...

short interview rejected

 1)Event driven  arctiture in nodejs: Event-driven architecture is a software design pattern commonly used in Node.js and other event-driven systems. It revolves around the concept of events, where components or modules communicate and interact by emitting and listening to events. In an event-driven architecture, the flow of the program is driven by events rather than being strictly sequential. Here's an overview of how it works in Node.js: Event Emitters: An event emitter is an object in Node.js that can emit events. It represents a source of events. Examples of event emitters in Node.js include the EventEmitter class, streams, and many built-in modules. Event Listeners: Event listeners are functions that are registered to listen for specific events emitted by event emitters. When an event is emitted, the registered listeners are invoked or called with the event data. Event listeners can perform specific actions or trigger additional events. Event Loop: Node.js utilizes an ev...