UI Developer
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...
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 (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...
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...
So, I was going through this video : https://www.youtube.com/watch?&v=4CeTFW4agRw - which talks about form validation in React, but is really general JavaScript form validation implemented in React. It has a line of code val.length > 0 && (valid = fa...
<?php define('INR_THOUSAND', 1000); define('INR_LAKH', 100 * INR_THOUSAND); define('INR_CRORE', 100 * INR_LAKH); echo amountInINR(15000)."\n"; echo amountInINR(1500000)."\n"; echo amountInINR(150000000)."\n"; echo amountInINR(9876543210)."\n"; func...