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
//ex.1: simple array | |
const average = (array) => { | |
const reducer = (sum, item) => { | |
return sum + item | |
} | |
return array.reduce(reducer, 0) / array.length | |
} | |
console.log(average([6,3,5,6])) | |
//output : 5 |
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 './App'; | |
import { createStore } from 'redux'; | |
const counterReducer = (state = 0,action) => { | |
switch(action.type){ | |
case 'INCREMENT': | |
return state + 1 |
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 { createStore } from 'redux'; | |
const counterReducer = (state = 0,action) => { | |
switch(action.type){ | |
case 'INCREMENT': | |
return state + 1 | |
case 'DECREMENT': | |
return state - 1 |
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
<!DOCTYPE NETSCAPE-Bookmark-file-1> | |
<!-- This is an automatically generated file. | |
It will be read and overwritten. | |
DO NOT EDIT! --> | |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | |
<TITLE>Bookmarks</TITLE> | |
<H1>Bookmarks</H1> | |
<DL><p> | |
<DT><H3 ADD_DATE="1639744473" LAST_MODIFIED="1639967469" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks</H3> | |
<DL><p> |
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 addBlog = () => { | |
const newBlog = { | |
title: newTitle, | |
author: newAuthor, | |
url: newUrl, | |
} | |
if(newBlog.title.length<4) | |
{ | |
return console.log('give longer value') |
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
//global settings of my vs code | |
{ | |
"workbench.activityBar.visible": true, | |
"explorer.confirmDelete": false, | |
"liveServer.settings.donotShowInfoMsg": true, | |
"liveServer.settings.donotVerifyTags": true, | |
"files.associations": { | |
"*.js": "javascript" | |
}, |
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
node_modules | |
build | |
.eslintrc.js | |
.prettierrc.js | |
.eslintcache |
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
{ | |
"emmet.includeLanguages": { | |
"javascript": "javascriptreact" | |
}, | |
"emmet.triggerExpansionOnTab": true, | |
"editor.codeActionsOnSave": { | |
//eslint-runs-automatically-on-save | |
"source.fixAll.eslint": true | |
}, | |
"eslint.validate": [ |
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
node_modules | |
build |
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
let x1, y1, x2, y2, result; | |
x1 = prompt('x1'); | |
y1 = prompt('y1'); | |
x2 = prompt('x2'); | |
y2 = prompt('y2'); | |
result = Math.sqrt(Math.pow((x2 - x1),2)+Math.pow((y2 - y1),2)); | |
console.log(result.toFixed(4)) |
OlderNewer