Skip to content

Instantly share code, notes, and snippets.

View anmolsukki's full-sized avatar
🎯
Software Engineer | Web Developer

Anmol Kumar Singh anmolsukki

🎯
Software Engineer | Web Developer
View GitHub Profile
@anmolsukki
anmolsukki / arrow-function-refactor.js
Last active May 3, 2020 23:02
[ Javascript ] arrow function refactor filter challenge (https://repl.it/@anmolsukki/refactorArrowFunction)
const tasks = {
task: [{
text: 'Grocery shopping',
completed: true
},{
text: 'Clean yard',
completed: true
}, {
text: 'Film course',
completed: false
@anmolsukki
anmolsukki / Toggle.js
Last active May 3, 2020 23:42
[ ReactJs ] create "ON OFF" toggle button (https://codesandbox.io/s/toggle-yzxy2)
import React from "react";
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isToggleOn: true,
isToggleAdd: true
};
}
@anmolsukki
anmolsukki / App.js
Last active May 4, 2020 03:25
[ ReactJs ] Toast Message popup display ( https://codesandbox.io/s/toastmessage-vvmwp )
import React from "react";
import Toast from "./Toast";
import "./Toast.css";
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
showToast: false,
level: "success",
import React from "react";
class ScreenSizes extends React.Component {
constructor() {
super()
this.state = {
width: 0,
height: 0
}
}
@anmolsukki
anmolsukki / Event.js
Last active May 4, 2020 03:26
[ ReactJs ] Date Time Event ( https://codesandbox.io/s/event-8x24w )
import React from 'react';
class Event extends React.Component {
constructor(props) {
super(props);
this.state = {
time: new Date()
}
}
import React from 'react';
import Highcharts from 'highcharts';
import { HighchartsChart, Chart, withHighcharts, XAxis, YAxis, Title, Subtitle, Legend, SplineSeries } from 'react-jsx-highcharts';
const plotOptions = {
series: {
animation:{
duration: 5000
}
}
@anmolsukki
anmolsukki / App.js
Last active May 4, 2020 03:27
[ Reactjs ] Simple Navbar ( https://codesandbox.io/s/navbar-wemy7 )
import React from "react";
import { Route, NavLink, HashRouter } from "react-router-dom";
import Home from "./Home";
import Stuff from "./Stuff";
import Contact from "./Contact";
import "./Main.css";
class App extends React.Component {
render() {
return (
@anmolsukki
anmolsukki / First.js
Created May 4, 2020 03:22
[ Reactjs ] Radio button event with sweetalert (https://codesandbox.io/s/radiobuttonwithsweetalert-x0d6l)
import React from "react";
import "./Style.css";
import swal from 'sweetalert';
class First extends React.Component {
constructor() {
super();
this.state = {
size: 'small'
};
import React from 'react';
import dishes from './Dishes'
class App extends React.Component {
constructor() {
super();
this.state = {
mealType: '',
peoples: 1,
onStep: 1,
  1. map function

The map function simply transforms one array into another array. For example, suppose you have an array of person objects but what you really need is an array of names (strings)

The map function will convert the array of person objects into an array of names (strings).

Lets say this is the array you start with:

const friends = [