Javascript Node Js basic to Advance
1.09K subscribers
4 photos
1 video
2 files
39 links
Javascript Node Js group

@LogicB_Support
@BCA_MCA_BTECH
Download Telegram
// 8. Object.getOwnPropertyNames()
let sampleObject = { name: 'John', age: 30 };
console.log(Object.getOwnPropertyNames(sampleObject));
// 9. Object.getPrototypeOf()
let sampleObject = {};
console.log(Object.getPrototypeOf(sampleObject));
// 10. Object.hasOwnProperty()
let sampleObject = { name: 'John', age: 30 };
console.log(sampleObject.hasOwnProperty('age'));
// 11. Object.create()
let sampleObject = { name: 'John', age: 30 };
let newObject = Object.create(sampleObject);
console.log(newObject);
// 12. Object.defineProperty()
let sampleObject = {};
Object.defineProperty(sampleObject, 'property1', {
value: 42,
writable: false
});
console.log(sampleObject.property1);
// 13. Object.defineProperties()
let sampleObject = {};
Object.defineProperties(sampleObject, {
property1: {
value: 42,
writable: true
},
property2: {
value: 'Hello',
writable: false
}
});
console.log(sampleObject.property1);
console.log(sampleObject.property2);
// 14. Object.getOwnPropertyDescriptors()
let sampleObject = { name: 'John', age: 30 };
let descriptors = Object.getOwnPropertyDescriptors(sampleObject);
console.log(descriptors);
// 15. Object.setPrototypeOf()
let sampleObject = {};
let prototypeObject = { prototypeProp: 'prototype' };
Object.setPrototypeOf(sampleObject, prototypeObject);
console.log(sampleObject.prototypeProp);
// 16. Object.is()
let value1 = 5;
let value2 = 5;
console.log(Object.is(value1, value2));
// 17. Object.entries()
let sampleObject = { a: 'Apple', b: 'Ball', c: 'Cat' };
let entries = Object.entries(sampleObject);
console.log(entries);
// 18. Object.fromEntries()
let entries = [['a', 1], ['b', 2], ['c', 3]];
let newObject = Object.fromEntries(entries);
console.log(newObject);
// 19. Object.values()
let sampleObject = { a: 'Apple', b: 'Ball', c: 'Cat' };
let values = Object.values(sampleObject);
console.log(values);
// 20. Object.keys()
let sampleObject = { a: 'Apple', b: 'Ball', c: 'Cat' };
let keys = Object.keys(sampleObject);
console.log(keys);
// 21. Object.preventExtensions()
let sampleObject = { name: 'John', age: 30 };
Object.preventExtensions(sampleObject);
// Prevents adding new properties to an object
// 22. Object.isExtensible()
let sampleObject = { name: 'John', age: 30 };
console.log(Object.isExtensible(sampleObject));
// Checks if an object is extensible or not
// 23. Object.isSealed()
let sampleObject = { name: 'John', age: 30 };
console.log(Object.isSealed(sampleObject));
// Checks if an object is sealed or not
// 24. Object.isFrozen()
let sampleObject = { name: 'John', age: 30 };
console.log(Object.isFrozen(sampleObject));
// Checks if an object is frozen or not
// 25. Object.getOwnPropertySymbols()
let sampleObject = { [Symbol('a')]: 'value' };
console.log(Object.getOwnPropertySymbols(sampleObject));
// Retrieves an array of all symbol properties found directly upon a given object
Object methods 👆
Numbers methods 👇
// 1. Number.parseFloat()
(async () => {
let { input } = require("jsshort");
let strFloat = await input("Enter a floating-point number: ");
console.log(Number.parseFloat(strFloat));
})();
👍2