screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <div id="app"></div> <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> <script type="text/babel"> const { useState, useEffect } = React; function App() { const array1 = [1, 2, 3, 4]; const array2 = [5, 6, 7, 8]; // Multiply the elements at corresponding positions const multipliedArray = array1.map((element, index) => element * array2[index]); return ( <div className='container'> <h3>React Js Multiple Two Array of Element</h3> <p className='array1'>Array 1 : {JSON.stringify(array1)}</p> <p className='array2'>Array 2 : {JSON.stringify(array2)}</p> <p className='multipliedArray'>Multiplication of Array 1 & Array 2 : {JSON.stringify(multipliedArray)}</p> </div> ); } ReactDOM.render(<App />, document.getElementById('app')); </script> <style> /* Styling for the container */ .container { max-width: 800px; margin: 0 auto; padding: 20px; font-family: Arial, sans-serif; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24); } .container p { margin: 10px; font-size: 16px; } .array1 { background-color: #E57373; padding: 10px; border-radius: 5px; color: #fff; } .array2 { background-color: #64B5F6; padding: 10px; border-radius: 5px; color: #fff; } .multipliedArray { background-color: #81C784; padding: 10px; border-radius: 5px; color: #fff; } </style> </body> </html>