Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • default keword in javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 221
    Comment on it

    defautl keyword is used in two situations
    1)switch statement.
    2)export statement.

    1) example of switch statement

    switch (expr) {
      case "Oranges":
        console.log("Oranges are my 1st choice.");
        break;
      case "Apples":
        console.log("Apples are second choice.");
        break;
      default:
        console.log("Sorry,Evon " + expr + ".");
    }
    

    2) example of export statement

    let cube = function cube(x) {
      return x * x * x;
    }
    export default cube;
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: