Photo by Pankaj Patel on Unsplash

Number:

const example1 = “100”;parseFloat(example1) // to convert string to number

String:

‘Jhon’.length // to find how many characters in this string
‘hello’.charAt(3) // is a thing that returns the characters of strings to that location.
‘hello, world’.replace(‘world’, ‘earth’)// to replace the old value to new value.
‘sahil’.toUpperCase()// to convert all string to upper case.
‘SAHIL’.toLowerCase()// to convert all string to lower case.
const stringObj = new String(‘foo’);console.log(stringObj);
// output
const toStaring = stringObj.toString()// convert object to stringconsole.log(toStaring);
// output

Array:

const plants = [‘broccoli’, ‘cauliflower’, ‘cabbage’, ‘kale’, ‘tomato’];const pop…

  1. what a callback function is
function modifyArray(arr, callback) {
// do something to arr here
arr.push(100);
// then execute the callback function that was passed
callback();
}

var arr = [1, 2, 3, 4, 5];

modifyArray(arr, function() {
console.log("array has been modified", arr);
});
var string = "Welcome to this Javascript Guide!";

// Output becomes !ediuG tpircsavaJ siht ot…

I write this blog from my experience.

1. installation

npm install -g create-react-app
npx create-react-app your-app-name
cd your-app-name
npm start

2.useState:

const [yourStateName, setYourStateName] = useState({
name:'John Smith'
})
const [yourStateName, setYourStateName] = useState([{
name:'John Smith'
}])

3.useEffect:

4.Fetch data on api and display it to the website:

import React, {useState, useEffect} from 'react';
const App = () => {
const [user, setUser] = useState([])
useEffect(()=>{fetch('https://jsonplaceholder.typicode.com/users')
.then(res => res.json())
.then(data => setUser(data))
},[])return(
<div>
{
user.map(user => <div>{user.name}</div>)
}
</div>
)
}

5.useContext:




  • HTML =Hypertext Markup Language: defines the structure and contents of a web…

Sahil Imrose Zahin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store