Anjanesh

HomeBadges
Blog Author Picture

Anjanesh Lekshminarayanan

1 follower

UI Developer

Accessing a JavaScript function of an object using [] instead of a dot (.)

Mar 14, 20211 min read

Today's post is super short and simple and it's probably known to most developers. It's about accessing a function of an object using [] instead of dot (.) Let's say you have a condition - if flag is true then use max, if false, use min. let result, ...

Serving an image as a script

Feb 23, 20212 min read

A lot of times, we try to track user details by embedding an image in the email which is actually a script that does some logging before actually spitting out the image content. This is old-school. logo.php : <?php $IP = $_SERVER['REMOTE_ADDR']; $B ...

Connecting MetaMask's web3 to a React app

Jan 11, 20211 min read

If you want your React app to connect to MetaMask's web3, const web3 = new Web3(window.web3.currentProvider);will no longer work as suggested. We need to MetaMask to authorize the connection which is a manual process by clicking on a button to author...

A form input & tabular output on the same page in Angular

Oct 29, 20205 min read

So, I have started learning Angular. I like it as it enforces OOPs concepts via TypeScript. Here I show how to input data into a form and display each entry as a row in a table. import FormsModule into app.module.ts import { FormsModule } from '@ang...

Number to words (crore and lakh)

Oct 19, 20209 min read

Number to words (Indian style - crore, lakh). The function is recursive. const HUNDRED = 100; const THOUSAND = HUNDRED * 10; const LAKH = THOUSAND * 100; const CRORE = LAKH * 100; function number2words(num) { let str = ''; if (num >= C...

One liner ES6 refactor

Oct 10, 20201 min read

How this function can be refactored to just one line ! This is a function returning a function that calls redux's dispatch() function manually. export const fetchUser = () => { return function(dispatch) { axios .get('/api/curr...

© 2021 Anjanesh

PrivacyTerms
Proudly part of