This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const arr = [10,20, , ,50]; | |
| console.log( arr ); | |
| console.log( arr[0] ); // output: 10 | |
| console.log( arr[2] ); // output: undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In some script or third party package. It is highly unlikely chance to get this type of script. | |
| Array.prototype['2'] = 'Praveen kumar'; | |
| // Our script | |
| const arr = [10,20, , ,50]; | |
| console.log( arr ); | |
| console.log( arr[0] ); // output: 10 | |
| console.log( arr[2] ); // output: Praveen kumar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import App from './components/App'; | |
| ReactDOM.render( | |
| <App />, | |
| document.querySelector( '#root' ) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const React = require( 'react' ); | |
| const CreateReactClass = require( 'create-react-class' ); | |
| const App = CreateReactClass( { | |
| render() { | |
| return React.createElement( 'h1', null, 'Hello world' ); | |
| } | |
| } ) | |
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const React = require( 'react' ); | |
| class App extends React.Component{ | |
| render() { | |
| return ( | |
| <h1>Hello world</h1> | |
| ) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const React = require( 'react' ); | |
| const CreateReactClass = require( 'create-react-class' ); | |
| const App = CreateReactClass( { | |
| getInitialState() { | |
| return { | |
| message: 'world' | |
| } | |
| }, | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| class App2 extends Component { | |
| constructor( props ) { | |
| super( props ); | |
| this.state = { | |
| message: 'world' | |
| } | |
| } | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| class App2 extends Component { | |
| state = { | |
| message: 'world' | |
| } | |
| render() { | |
| return ( | |
| <h1>Hello {this.state.message} in ES6 classes outside of constuctor</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const React = require( 'react' ); | |
| const CreateReactClass = require( 'create-react-class' ); | |
| const App = CreateReactClass( { | |
| getDefaultProps() { | |
| return { | |
| message: 'world' | |
| } | |
| }, | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import App from './App'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <h1>Hello {this.props.message}</h1> | |
| ); | |
| } | |
| } |
OlderNewer