screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.development.js"></script> <!---this is used to compile on run time---> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <h3>React Js use the map() method to create a new array of doubled numbers Example</h3> <div id="app"></div> <script type="text/babel"> function App() { const numbers = [1, 2, 3, 4, 5]; const doubledNumbers = numbers.map((number) => { return number * 2; }); return ( <div> <p>Original numbers: {numbers.join(', ')}</p> <p>Doubled numbers: {doubledNumbers.join(', ')}</p> </div> ); } ReactDOM.render(<App />, document.getElementById('app')); </script> </body> </html>