Skip to content

Instantly share code, notes, and snippets.

View jx13xx's full-sized avatar
🎯
Focusing

Gekk boyy jx13xx

🎯
Focusing
  • Dubai, United Arab Emriates
View GitHub Profile
@jx13xx
jx13xx / App.js
Created February 2, 2022 01:48
Dyanmic List in React JSX
const comments = [
{id: 1, text: 'Comment One'},
{id: 2, text: 'Comment Two'},
{id: 3, text: 'Comment Three'},
]
function App() {
return (
<div className='comments'>
<h3>Comments ({comments.length})</h3>
@jx13xx
jx13xx / condtional_jsx.js
Created February 2, 2022 01:59
Conditionals in JSX
const showComments = true;
function App() {
return (
<div className='container'>
<h1>Blog Post</h1>
{showComments ? (<div className='comments'>
<h3>Comments ({comments.length})</h3>
@jx13xx
jx13xx / App.js
Created February 6, 2022 15:14
Custom Button React Component
return (
<Card>
<form>
<h2> How you rate your service with us?</h2>
<div className={'input-group'}>
<input
onChange={handleTextChange}
type={'text'}
placeholder={'Write a review'}
value={text}/>
@jx13xx
jx13xx / gist:81eb23a716e321ddd1c4025cdfd4a225
Created March 19, 2022 12:50
IIFE - Immediately Invoked Fucntion Expressions Javascript
var firstname = "MyNamew";
(function(name){
var greeting = "Inside IIFE: Hellow"
console.log(greeting + '' + name);
}(firstname))
@jx13xx
jx13xx / app.js
Created April 1, 2022 12:45
reduce, map, filter example javascript
const scores = [50, 6, 100, 0, 10, 75, 8, 60, 90, 80, 0, 30, 110];
//Any scores that are below 10 needs to be multiplied by 10 and the new value included.
const boostSingleScores = scores.map(function (val) {
return (val < 10) ? val *10 : val;
})
//Remove any scores that are over 100.
class Employee {
constructor(name, daysWorked) {
this.name = name;
this.daysWorked = daysWorked;
}
calculatePay() {
const dailyPay = 100; // let's assume daily pay is 100
return this.daysWorked * dailyPay;
}