Categories
Javascript

How to check that javascript object contains the given key?

A wet man does not fear the rain. Issue:-How do I check if an object has a key in JavaScript? Example:- // Sample Object const REMINDER = “REMIND_ME”; reminderObj= { INBOX:`${REMINDER}_INBOX`, USERS:`${REMINDER}_USERS`, GROUPS:`${REMINDER}_GROUPS`, } Problem1: Now we want to check that our object have “INBOX” as key or not? Solution:-  Object.prototype.hasOwnProperty.call(reminderObj,”INBOX”); Note:- We could directly […]

Categories
Javascript

How to use FormattedMessage for input placeholder in React?

Problem:- How we can translate the placeholder text for input-box using formatmessage? Solution:- If we use react-intl its not meant to be used with  placeholders, alternate text, etc. They render HTML, not plain text, which is not useful in our scenario. 1. Incase we have one or two values to translate, we can use FormattedMessage as wrapper […]

Categories
Wordpress

Handy tips and Tools for working with wordpress -Part1?

Don’t judge each day by the harvest you reap but by the seeds that you plant.” Robert Louis Stevenson 1.How to add icons in wordpress pages ? Solution:- By using the “Better Font Awesome” plugin Steps1:- Install and activate the plugin in wordpress. Steps2:- Search the given icon from the font-awesome library, add the code […]