Guest User

Untitled

a guest
Aug 15th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. // JavaScript Variables and Objects
  2.  
  3. // Write your code below.
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. // __________________________________________
  11. // Test Code: Do not alter code below this line.
  12.  
  13. function assert(test, message, test_number) {
  14. if (!test) {
  15. console.log(test_number + "failed: " + message);
  16. throw "ERROR: " + message;
  17. }
  18. console.log(test_number + "PASS!");
  19. return "Awesome job!";
  20. }
  21.  
  22. assert(
  23. (typeof secretNumber === 'number'),
  24. "The value of secretNumber should be a number.",
  25. "1. "
  26. )
  27.  
  28. assert(
  29. secretNumber === 7,
  30. "The value of secretNumber should be 7.",
  31. "2. "
  32. )
  33.  
  34. assert(
  35. typeof password === 'string',
  36. "The value of password should be a string.",
  37. "3. "
  38. )
  39.  
  40. assert(
  41. password === "just open the door",
  42. "The value of password should be 'just open the door'.",
  43. "4. "
  44. )
  45.  
  46. assert(
  47. typeof allowedIn === 'boolean',
  48. "The value of allowedIn should be a boolean.",
  49. "5. "
  50. )
  51.  
  52. assert(
  53. allowedIn === false,
  54. "The value of allowedIn should be false.",
  55. "6. "
  56. )
  57.  
  58. assert(
  59. members instanceof Array,
  60. "The value of members should be an array",
  61. "7. "
  62. )
  63.  
  64. assert(
  65. members[0] === "Mary",
  66. "The first element in the value of members should be 'Mary'.",
  67. "8. "
  68. )
  69.  
  70. assert(
  71. members[3] === "John",
  72. "The fourth element in the value of members should be 'John'.",
  73. "9. "
  74. )
Add Comment
Please, Sign In to add comment