DAY7: Flexbox

Flexbox principles

JAVASCRIPT

Ques. how to implement polymorphism in js?

Ans. In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types, or the use of a single symbol to represent multiple different types.

        function greet(name = '',language ='english'){  
            if(language==='english'){ 
                console.log(`Hello ${name}`) 
            } 
            else if (language==='spanish'){
                console.log(`Hola ${name}`)
            }
        }
        console.log('john'); // Hello john
        console.log('james','spanish'); //Hola james