This file contains 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
// Formulaire de connexion : CALLBACK | |
function connection(username,password,email){ | |
if(username.length !== 0) { | |
console.log("username OK !"); | |
} if(password.length <= 6){ | |
console.log("Le mot de passe est trop court"); | |
} if(!email.includes("@")) { | |
console.log("Votre email n'est pas valide"); | |
} |
This file contains 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
// Fonction pour calculer un age | |
function calculateAge(yearOfBirth) { // pour calculer l'age il faut une année de naissance | |
let age = 2020 - yearOfBirth | |
console.log(age) //on aurait pu mettre le ocnsole.log après la déclaration de la constante ageBob | |
return age | |
} | |
const ageBob = calculateAge(1985); | |
This file contains 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
// Fonction pour calculer un age | |
function calculateAge(yearOfBirth) { // pour calculer l'age il faut une année de naissance | |
let age = 2020 - yearOfBirth | |
console.log(age) //on aurait pu mettre le ocnsole.log après la déclaration de la constante ageBob | |
return age | |
} | |
const ageBob = calculateAge(1985); | |
const ageMary = calculateAge(1950); |
This file contains 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
function calculateAge(yearOfBirth) { // pour calculer l'age il faut une année de naissance | |
let age = 2020 - yearOfBirth | |
console.log(age) //on aurait pu mettre le ocnsole.log après la déclaration de la constante ageBob | |
return age | |
} | |
const ageBob = calculateAge(1985); |
This file contains 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
function getNote(counter, notes, higher, lower) { | |
if (!higher && !lower) { | |
higher = notes[counter]; | |
lower = notes[counter]; | |
counter++; | |
} | |
if (counter < notes.length) { | |
higher = higher > notes[counter] ? higher : notes[counter]; | |
lower = lower < notes[counter] ? lower : notes[counter]; | |
counter++; |
This file contains 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
function transformText(word) { | |
const firstLetter = word.substring(0, 1).toUpperCase() // Récupere la premiere lettre et la transforme en majuscule | |
const otherLetters = word.substring(1).toLowerCase() // Récupere les autres lettres et les transforme en minuscule | |
return `${firstLetter}${otherLetters}` // Concatenation des deux variables | |
} | |
const newWord = transformText('MAGIQUE'); | |
console.log(newWord); |
This file contains 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
// Initialization of variable n to 0 | |
let n = 0 | |
do { | |
// Display a message in the console with the value n | |
console.log('n : ' + n) | |
// Increment n by 1 (n = n + 1) | |
n++ | |
} while (n < 3) |
This file contains 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
<?php | |
function year_shortcode () { | |
$year = date_i18n ('Y'); | |
return $year; | |
} | |
add_shortcode ('year', 'year_shortcode'); |
This file contains 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
<!--Créer un produit appellé "Shipping Insurance" à 3 dollars, mettez-le en produit caché (visibilité catalogue dans le côté droit) --> | |
<?php | |
add_action('woocommerce_cart_totals_after_shipping', 'wc_shipping_insurance_note_after_cart'); | |
function wc_shipping_insurance_note_after_cart() { | |
global $woocommerce; | |
$product_id = 669; //mettre l'ID de l'assurance livraison | |
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) { | |
$_product = $values['data']; |
This file contains 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
<?php | |
// Targets custom order status "refused" | |
// Uses 'woocommerce_order_status_' hook | |
add_action( 'woocommerce_order_status_refused', 'bbloomer_status_custom_notification', 20, 2 ); | |
function bbloomer_status_custom_notification( $order_id, $order ) { | |
NewerOlder