screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <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 src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> const { useEffect, useState } = React; const App = () => { const stringArray = ["1", "2", "3", "4", "5"]; // Convert string array to number array const numberArray = stringArray.map((str) => parseInt(str, 10)); return ( <div className="container"> <h3>React Js Convert Array of Sting in to Array of Number</h3> <p>String Array: {stringArray.join(", ")}</p> <p>Number Array: {numberArray.join(", ")}</p> </div> ); }; ReactDOM.render(<App />, document.getElementById("app")); </script> <style> .container { text-align: center; margin: 0 auto; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 3px 5px 0 rgba(0, 0, 0, 0.24); } </style> </body> </html>