Display Current Date and Time in JSX in ReactJs challenge
Display Current Date and Time in JSX in ReactJs challenge
- Create a react app from scratch
- Add one h1 element ex. Your Name
- Add one p element in it with Current Date
- Add one p element in it with Current Time
import React from 'react';import ReactDOM from 'react-dom';const name = "shreyash kolhe";const currentDate = new Date().toLocaleDateString();const currentTime = new Date().toLocaleTimeString();ReactDOM.render(<><h1>{`Hello, My name is ${name}`}</h1><p>{`Today Date is = ${currentDate}`}</p><p>{`Current Time is = ${currentTime}`}</p></>,document.getElementById("root"));
OUTPUT
Post a Comment