Arrow Function using
ReactJs
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
var a=()=>{
var a=50;
var b=10;
var c=a+b;
document.getElementById('root').innerHTML=c;
}
a();
/*root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);*/
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
Output
Passing Argument to Arrow
Function
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
var a=(x)=>{
var a=50;
var b=10;
var c=a+b+x;
document.getElementById('root').innerHTML=c;
}
a(20);
/*root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);*/
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
Output
No comments:
Post a Comment