Skip to content

Instantly share code, notes, and snippets.

const episodes = [
{ id: 's06e01', title: 'Pilot' },
{ id: 's06e02', title: 'Top Banana' },
{ id: 's06e03', title: 'Charity Drive' },
{ id: 's06e04', title: 'Visiting Ours' },
{ id: 's06e05', title: 'My Mother, the Car' },
{ id: 's06e06', title: 'In God We Trust' },
{ id: 's06e07', title: 'Storming the castle' },
{ id: 's06e08', title: 'Pier Pressure' },
const pokemon = [
{ name: 'pikachu', strength: 5, evolved: false, },
{ name: 'snorlax', strength: 3, evolved: false, },
{ name: 'mewtwo', strength: 2.5, evolved: false, },
{ name: 'onyx', strength: 1.5, evolved: false, },
];
const transformedPokemon = pokemon.map(function (pokemon) {
return Object.assign({}, pokemon, {
strength: pokemon.strength * 2,
var cars = ["honda", "hondai", "dodge", "jeep"]
//USING forEach()
cars.forEach(function(car){
console.log(car);
})
//=> honda
//=>hondai
//=>dodge
//=>jeep
import React from 'react';
import { ScrollView, Text, StyleSheet, View, TextInput, ListView } from 'react-native';
export default class App extends React.Component {
constructor(){
super();
import React from 'react';
import { ScrollView, Text, StyleSheet, View, TextInput } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View>
import React from 'react';
import { ScrollView, Text, StyleSheet, View } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.background}>
<ScrollView >
{this.props.text.map((item)=>
import React from 'react';
import { StyleSheet, Text, View, TextInput, Image } from 'react-native';
export default class App extends React.Component {
constructor(){
super();
this.state={
text: ''
}
this.handleClick = this.handleClick.bind(this);
componentWillReceiveProps(nextProps){
console.log('d')
if(nextProps !== this.props){
this.setState({
complete: false
})
}
}
shouldComponentUpdate(nextProps, nextState){
import React from 'react';
class Todo extends React.Component{
constructor(){
super();
this.state={
complete: false
}
import React from 'react';
class Todo extends React.Component{
constructor(){
super();
this.state={
complete: false
}