Skip to content

Instantly share code, notes, and snippets.

View Kingno3l's full-sized avatar

King Immanuel Kingno3l

View GitHub Profile
<!-- add this to your header -->
<div id="google_translate_element"></div>
<!-- to your js part -->
<script src="script.js"></script>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement(
{pageLanguage: 'en'},
'google_translate_element'
//The JavaScript code is considered DRY as it defines a single function, greet, that can be called multiple times with different arguments to produce different outputs.
//The CSS styles could also be considered DRY as they have a common class .greetings for shared styles, and individual classes for specific styles.
const greet = (message, name) => {
console.log(`${message}, ${name}!`)
}
greet('Hello', 'John');
greet('Hola', 'Antonio');
@Kingno3l
Kingno3l / example1.js
Created February 6, 2023 08:15
Microverse IT IS DRY Exercise
const pets = ['Cat', 'Dog', 'Bird', 'Fish', 'Frog', 'Hamster', 'Pig', 'Horse', 'Lion', 'Dragon'];
// Print all pets
console.log(pets[0]);
console.log(pets[1]);
console.log(pets[2]);
console.log(pets[3]);
.cat {
font-family: "Times New Roman", Times, serif;
font-size: 1rem;