Skip to content

Instantly share code, notes, and snippets.

View shubhamt619's full-sized avatar
🎯
Focusing

Shubham Thakur shubhamt619

🎯
Focusing
View GitHub Profile
@shubhamt619
shubhamt619 / index.html
Created August 26, 2022 10:13
Using data attributes in vanilla JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Attributes</title>
</head>
@shubhamt619
shubhamt619 / data-attribute-vanilla-javascript.js
Created August 26, 2022 10:19
data-attribute-vanilla-javascript
function printAge(studentId) {
// Get the <li> which is clicked
let studentListItem = document.querySelector(`[data-id="${studentId}"]`);
// Get the age from the data attribute 'age'
let age = studentListItem.dataset.age;
// Finally log it to console, Duh !
console.log('Age of the clicked student is ', age);
}
setTimeout(function(){
console.log("I like turtles!");
}, 5000);
console.log("Hey, I am Sam");
function square(number) {
let squareOfNumber = number * number;
return squareOfNumber;
}
function cube(number) {
let cubeOfNumber = Math.pow(number, 3);
return cubeOfNumber;
}
function cube(number) {
let cubeOfNumber = Math.pow(number, 3);
return cubeOfNumber;
}
function square(number) {
let squareOfNumber = number * number;
return squareOfNumber;
}
function findPower(number, power) {
let powerOfNumber = Math.pow(number, power);
return powerOfNumber;
}
@shubhamt619
shubhamt619 / main.dart
Created February 12, 2023 12:09
serene-glacier-1485
final validAlphanumericCharacters = RegExp(r'^[a-zA-Z0-9]+$');
var arr = [
"230200666PO10001",
"230200666PO10002",
"230200666PO10003",
"230200666PO10004",
"230200742PO10001",