diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.english.md index abe80a0728..11afe2a0e6 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.english.md @@ -48,15 +48,15 @@ Add all necessary code so the Dog object inherits from Animal ```yml tests: - text: Animal should not respond to the bark() method. - testString: assert(typeof Animal.prototype.bark == "undefined", 'Animal should not respond to the bark() method.'); + testString: assert(typeof Animal.prototype.bark == "undefined"); - text: Dog should inherit the eat() method from Animal. - testString: assert(typeof Dog.prototype.eat == "function", 'Dog should inherit the eat() method from Animal.'); + testString: assert(typeof Dog.prototype.eat == "function"); - text: Dog should have the bark() method as an own property. - testString: assert(Dog.prototype.hasOwnProperty('bark'), 'Dog should have the bark() method as an own property.'); + testString: assert(Dog.prototype.hasOwnProperty('bark')); - text: beagle should be an instanceof Animal. - testString: assert(beagle instanceof Animal, 'beagle should be an instanceof Animal.'); + testString: assert(beagle instanceof Animal); - text: The constructor for beagle should be set to Dog. - testString: assert(beagle.constructor === Dog, 'The constructor for beagle should be set to Dog.'); + testString: assert(beagle.constructor === Dog); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.english.md index 7a89cb33a6..2ce1fb5e33 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.english.md @@ -51,13 +51,13 @@ Add the property numLegs and the two methods eat() and ```yml tests: - text: Dog.prototype should be set to a new object. - testString: assert((/Dog\.prototype\s*?=\s*?{/).test(code), 'Dog.prototype should be set to a new object.'); + testString: assert((/Dog\.prototype\s*?=\s*?{/).test(code)); - text: Dog.prototype should have the property numLegs. - testString: assert(Dog.prototype.numLegs !== undefined, 'Dog.prototype should have the property numLegs.'); + testString: assert(Dog.prototype.numLegs !== undefined); - text: Dog.prototype should have the method eat(). - testString: assert(typeof Dog.prototype.eat === 'function', 'Dog.prototype should have the method eat().'); + testString: assert(typeof Dog.prototype.eat === 'function'); - text: Dog.prototype should have the method describe(). - testString: assert(typeof Dog.prototype.describe === 'function', 'Dog.prototype should have the method describe().'); + testString: assert(typeof Dog.prototype.describe === 'function'); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.english.md index 8bb5eb28ea..44a38edf78 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.english.md @@ -32,11 +32,11 @@ Create a dog object with name and n ```yml tests: - text: dog should be an object. - testString: assert(typeof(dog) === 'object', 'dog should be an object.'); + testString: assert(typeof(dog) === 'object'); - text: dog should have a name property set to a string. - testString: assert(typeof(dog.name) === 'string', 'dog should have a name property set to a string.'); + testString: assert(typeof(dog.name) === 'string'); - text: dog should have a numLegs property set to a number. - testString: assert(typeof(dog.numLegs) === 'number', 'dog should have a numLegs property set to a number.'); + testString: assert(typeof(dog.numLegs) === 'number'); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.english.md index 4b2bbdcbcd..e8ae4c3ab1 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.english.md @@ -34,9 +34,9 @@ Using the dog object, give it a method called sa ```yml tests: - text: dog.sayLegs() should be a function. - testString: assert(typeof(dog.sayLegs) === 'function', 'dog.sayLegs() should be a function.'); + testString: assert(typeof(dog.sayLegs) === 'function'); - text: dog.sayLegs() should return the given string - note that punctuation and spacing matter. - testString: assert(dog.sayLegs() === 'This dog has 4 legs.', 'dog.sayLegs() should return the given string - note that punctuation and spacing matter.'); + testString: assert(dog.sayLegs() === 'This dog has 4 legs.'); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.english.md index 6b31feb082..ce9fc1dd3a 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.english.md @@ -33,11 +33,11 @@ Create a constructor, Dog, with properties name< ```yml tests: - text: Dog should have a name property set to a string. - testString: assert(typeof (new Dog()).name === 'string', 'Dog should have a name property set to a string.'); + testString: assert(typeof (new Dog()).name === 'string'); - text: Dog should have a color property set to a string. - testString: assert(typeof (new Dog()).color === 'string', 'Dog should have a color property set to a string.'); + testString: assert(typeof (new Dog()).color === 'string'); - text: Dog should have a numLegs property set to a number. - testString: assert(typeof (new Dog()).numLegs === 'number', 'Dog should have a numLegs property set to a number.'); + testString: assert(typeof (new Dog()).numLegs === 'number'); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.english.md index b9e91a695e..835670564f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.english.md @@ -50,13 +50,13 @@ Create another Dog constructor. This time, set it up to take the pa ```yml tests: - text: Dog should receive an argument for name. - testString: assert((new Dog('Clifford')).name === 'Clifford', 'Dog should receive an argument for name.'); + testString: assert((new Dog('Clifford')).name === 'Clifford'); - text: Dog should receive an argument for color. testString: assert((new Dog('Clifford', 'yellow')).color === 'yellow', 'Dog should receive an argument for color.'); - text: Dog should have property numLegs set to 4. - testString: assert((new Dog('Clifford')).numLegs === 4, 'Dog should have property numLegs set to 4.'); + testString: assert((new Dog('Clifford')).numLegs === 4); - text: terrier should be created using the Dog constructor. - testString: assert(terrier instanceof Dog, 'terrier should be created using the Dog constructor.'); + testString: assert(terrier instanceof Dog); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.english.md index 23172355a0..572f90a47b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.english.md @@ -49,17 +49,17 @@ Use Object.create to make two instances of Animal name ```yml tests: - text: The duck variable should be defined. - testString: assert(typeof duck !== "undefined", 'The duck variable should be defined.'); + testString: assert(typeof duck !== "undefined"); - text: The beagle variable should be defined. - testString: assert(typeof beagle !== "undefined", 'The beagle variable should be defined.'); + testString: assert(typeof beagle !== "undefined"); - text: The duck variable should be initialised with Object.create. - testString: assert(/(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test(code), 'The duck variable should be initialised with Object.create.'); + testString: assert(/(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test(code)); - text: The beagle variable should be initialised with Object.create. - testString: assert(/(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test(code), 'The beagle variable should be initialised with Object.create.'); + testString: assert(/(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test(code)); - text: duck should have a prototype of Animal. - testString: assert(duck instanceof Animal, 'duck should have a prototype of Animal.'); + testString: assert(duck instanceof Animal); - text: beagle should have a prototype of Animal. - testString: assert(beagle instanceof Animal, 'beagle should have a prototype of Animal.'); + testString: assert(beagle instanceof Animal); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.english.md index 43ff94bdd9..2e60e80515 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.english.md @@ -49,11 +49,11 @@ Add all of the own properties of beagle to the array < ```yml tests: - text: The ownProps array should include "name". - testString: assert(ownProps.indexOf('name') !== -1, 'The ownProps array should include "name".'); + testString: assert(ownProps.indexOf('name') !== -1); - text: The prototypeProps array should include "numLegs". - testString: assert(prototypeProps.indexOf('numLegs') !== -1, 'The prototypeProps array should include "numLegs".'); + testString: assert(prototypeProps.indexOf('numLegs') !== -1); - text: Solve this challenge without using the built in method Object.keys(). - testString: assert(!/\Object.keys/.test(code), 'Solve this challenge without using the built in method Object.keys().'); + testString: assert(!/\Object.keys/.test(code)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.english.md index 484d5b0e8b..94988a0234 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.english.md @@ -34,9 +34,9 @@ Modify the dog.sayLegs method to remove any references to dog ```yml tests: - text: dog.sayLegs() should return the given string. - testString: assert(dog.sayLegs() === 'This dog has 4 legs.', 'dog.sayLegs() should return the given string.'); + testString: assert(dog.sayLegs() === 'This dog has 4 legs.'); - text: Your code should use the this keyword to access the numLegs property of dog. - testString: assert(code.match(/this\.numLegs/g), 'Your code should use the this keyword to access the numLegs property of dog.'); + testString: assert(code.match(/this\.numLegs/g)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.english.md index f3259bc708..de1543a198 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.english.md @@ -59,9 +59,9 @@ Override the fly() method for Penguin so that it retur ```yml tests: - text: penguin.fly() should return the string "Alas, this is a flightless bird." - testString: assert(penguin.fly() === "Alas, this is a flightless bird.", 'penguin.fly() should return the string "Alas, this is a flightless bird."'); + testString: assert(penguin.fly() === "Alas, this is a flightless bird."); - text: The bird.fly() method should return "I am flying!" - testString: assert((new Bird()).fly() === "I am flying!", 'The bird.fly() method should return "I am flying!"'); + testString: assert((new Bird()).fly() === "I am flying!"); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.english.md index 1f3e4765ed..962b46ce09 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.english.md @@ -42,7 +42,7 @@ Define the constructor property on the Dog proto ```yml tests: - text: Dog.prototype should set the constructor property. - testString: assert(Dog.prototype.constructor === Dog, 'Dog.prototype should set the constructor property.'); + testString: assert(Dog.prototype.constructor === Dog); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.english.md index 67bd6b7700..8853e7d602 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.english.md @@ -36,13 +36,13 @@ Fix the code so duck.constructor and beagle.constructorBird.prototype should be an instance of Animal. - testString: assert(Animal.prototype.isPrototypeOf(Bird.prototype), 'Bird.prototype should be an instance of Animal.'); + testString: assert(Animal.prototype.isPrototypeOf(Bird.prototype)); - text: duck.constructor should return Bird. - testString: assert(duck.constructor === Bird, 'duck.constructor should return Bird.'); + testString: assert(duck.constructor === Bird); - text: Dog.prototype should be an instance of Animal. - testString: assert(Animal.prototype.isPrototypeOf(Dog.prototype), 'Dog.prototype should be an instance of Animal.'); + testString: assert(Animal.prototype.isPrototypeOf(Dog.prototype)); - text: beagle.constructor should return Dog. - testString: assert(beagle.constructor === Dog, 'beagle.constructor should return Dog.'); + testString: assert(beagle.constructor === Dog); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.english.md index ee16d4ffdf..2830afc937 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.english.md @@ -34,7 +34,7 @@ Modify the code so that instances of Dog inherit from Animal< ```yml tests: - text: Dog.prototype should be an instance of Animal. - testString: assert(Animal.prototype.isPrototypeOf(Dog.prototype), 'Dog.prototype should be an instance of Animal.'); + testString: assert(Animal.prototype.isPrototypeOf(Dog.prototype)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.english.md index 1db1286db3..e45bba1f50 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.english.md @@ -43,11 +43,11 @@ Write a joinDogFraternity function that takes a candidatejoinDogFraternity should be defined as a function. - testString: assert(typeof(joinDogFraternity) === 'function', 'joinDogFraternity should be defined as a function.'); + testString: assert(typeof(joinDogFraternity) === 'function'); - text: joinDogFraternity should return true ifcandidate is an instance of Dog. - testString: assert(joinDogFraternity(new Dog("")) === true, 'joinDogFraternity should return true ifcandidate is an instance of Dog.'); + testString: assert(joinDogFraternity(new Dog("")) === true); - text: joinDogFraternity should use the constructor property. - testString: assert(/\.constructor/.test(code) && !/instanceof/.test(code), 'joinDogFraternity should use the constructor property.'); + testString: assert(/\.constructor/.test(code) && !/instanceof/.test(code)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.english.md index 494b1f8eea..7461d0952e 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.english.md @@ -36,7 +36,7 @@ Use isPrototypeOf to check the prototype of beag ```yml tests: - text: Show that Dog.prototype is the prototype of beagle - testString: assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code), 'Show that Dog.prototype is the prototype of beagle'); + testString: assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.english.md index 732ac88543..f38cbc5180 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.english.md @@ -48,9 +48,9 @@ Use the Dog constructor from the last lesson to create a new instan ```yml tests: - text: hound should be created using the Dog constructor. - testString: assert(hound instanceof Dog, 'hound should be created using the Dog constructor.'); + testString: assert(hound instanceof Dog); - text: Your code should use the new operator to create an instance of Dog. - testString: assert(code.match(/new/g), 'Your code should use the new operator to create an instance of Dog.'); + testString: assert(code.match(/new/g)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.english.md index 2cd1e9ff33..c4e7d1bc55 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.english.md @@ -55,11 +55,11 @@ Create a mixin named glideMixin that defines a method ```yml tests: - text: Your code should declare a glideMixin variable that is a function. - testString: assert(typeof glideMixin === "function", 'Your code should declare a glideMixin variable that is a function.'); + testString: assert(typeof glideMixin === "function"); - text: Your code should use the glideMixin on the bird object to give it the glide method. - testString: assert(typeof bird.glide === "function", 'Your code should use the glideMixin on the bird object to give it the glide method.'); + testString: assert(typeof bird.glide === "function"); - text: Your code should use the glideMixin on the boat object to give it the glide method. - testString: assert(typeof boat.glide === "function", 'Your code should use the glideMixin on the boat object to give it the glide method.'); + testString: assert(typeof boat.glide === "function"); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.english.md index a2f5e9d92f..e23ab21427 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.english.md @@ -61,11 +61,11 @@ Create a module named funModule to wrap the two ```yml tests: - text: funModule should be defined and return an object. - testString: assert(typeof funModule === "object", 'funModule should be defined and return an object.'); + testString: assert(typeof funModule === "object"); - text: funModule.isCuteMixin should access a function. - testString: assert(typeof funModule.isCuteMixin === "function", 'funModule.isCuteMixin should access a function.'); + testString: assert(typeof funModule.isCuteMixin === "function"); - text: funModule.singMixin should access a function. - testString: assert(typeof funModule.singMixin === "function", 'funModule.singMixin should access a function.'); + testString: assert(typeof funModule.singMixin === "function"); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.english.md index c47a6362a9..d77de2b42c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.english.md @@ -47,11 +47,11 @@ Change how weight is declared in the Bird function so ```yml tests: - text: The weight property should be a private variable and should be assigned the value of 15. - testString: assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g), 'The weight property should be a private variable and should be assigned the value of 15.'); + testString: assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); - text: Your code should create a method in Bird called getWeight that returns the value of the private variable weight. - testString: assert((new Bird()).getWeight() === 15, 'Your code should create a method in Bird called getWeight that returns the value of the private variable weight.'); + testString: assert((new Bird()).getWeight() === 15); - text: Your getWeight function should return the private variable weight. - testString: assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g), 'Your getWeight function should return the private variable weight.'); + testString: assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.english.md index 0a792007b9..05aa863192 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.english.md @@ -63,11 +63,11 @@ The eat method is repeated in both Cat and Bear< ```yml tests: - text: Animal.prototype should have the eat property. - testString: assert(Animal.prototype.hasOwnProperty('eat'), 'Animal.prototype should have the eat property.'); + testString: assert(Animal.prototype.hasOwnProperty('eat')); - text: Bear.prototype should not have the eat property. - testString: assert(!(Bear.prototype.hasOwnProperty('eat')), 'Bear.prototype should not have the eat property.'); + testString: assert(!(Bear.prototype.hasOwnProperty('eat'))); - text: Cat.prototype should not have the eat property. - testString: assert(!(Cat.prototype.hasOwnProperty('eat')), 'Cat.prototype should not have the eat property.'); + testString: assert(!(Cat.prototype.hasOwnProperty('eat'))); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.english.md index e767bd01a0..321db5a5f1 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.english.md @@ -36,11 +36,11 @@ Add a numLegs property to the prototype of Dogbeagle should have a numLegs property. - testString: assert(beagle.numLegs !== undefined, 'beagle should have a numLegs property.'); + testString: assert(beagle.numLegs !== undefined); - text: beagle.numLegs should be a number. - testString: assert(typeof(beagle.numLegs) === 'number' , 'beagle.numLegs should be a number.'); + testString: assert(typeof(beagle.numLegs) === 'number' ); - text: numLegs should be a prototype property not an own property. - testString: assert(beagle.hasOwnProperty('numLegs') === false, 'numLegs should be a prototype property not an own property.'); + testString: assert(beagle.hasOwnProperty('numLegs') === false); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.english.md index a61eeb9a5b..9c3cb5f92f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.english.md @@ -45,9 +45,9 @@ Create a new instance of the House constructor, calling it my ```yml tests: - text: myHouse should have a numBedrooms attribute set to a number. - testString: assert(typeof myHouse.numBedrooms === 'number', 'myHouse should have a numBedrooms attribute set to a number.'); + testString: assert(typeof myHouse.numBedrooms === 'number'); - text: Be sure to verify that myHouse is an instance of House using the instanceof operator. - testString: assert(/myHouse\s*instanceof\s*House/.test(code), 'Be sure to verify that myHouse is an instance of House using the instanceof operator.'); + testString: assert(/myHouse\s*instanceof\s*House/.test(code)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.english.md index 3c6b4f38ba..39ccea681a 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.english.md @@ -31,13 +31,13 @@ Change the regex favRegex to match both the American English (favor ```yml tests: - text: Your regex should use the optional symbol, ?. - testString: assert(favRegex.source.match(/\?/).length > 0, 'Your regex should use the optional symbol, ?.'); + testString: assert(favRegex.source.match(/\?/).length > 0); - text: Your regex should match "favorite" - testString: assert(favRegex.test("favorite"), 'Your regex should match "favorite"'); + testString: assert(favRegex.test("favorite")); - text: Your regex should match "favourite" - testString: assert(favRegex.test("favourite"), 'Your regex should match "favourite"'); + testString: assert(favRegex.test("favourite")); - text: Your regex should not match "fav" - testString: assert(!favRegex.test("fav"), 'Your regex should not match "fav"'); + testString: assert(!favRegex.test("fav")); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.english.md index 4185675441..4f04324cc0 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.english.md @@ -31,15 +31,15 @@ Then fix the code so that the regex that you have created is checked against myRegex should return true for the string Franklin D. Roosevelt - testString: assert(myRegex.test('Franklin D. Roosevelt'), 'Your regex myRegex should return true for the string Franklin D. Roosevelt'); + testString: assert(myRegex.test('Franklin D. Roosevelt')); - text: Your regex myRegex should return true for the string Eleanor Roosevelt - testString: assert(myRegex.test('Eleanor Roosevelt'), 'Your regex myRegex should return true for the string Eleanor Roosevelt'); + testString: assert(myRegex.test('Eleanor Roosevelt')); - text: Your regex myRegex should return false for the string Franklin Rosevelt - testString: assert(!myRegex.test('Franklin Rosevelt'), 'Your regex myRegex should return false for the string Franklin Rosevelt'); + testString: assert(!myRegex.test('Franklin Rosevelt')); - text: You should use .test() to test the regex. - testString: assert(code.match(/myRegex.test\(\s*myString\s*\)/), 'You should use .test() to test the regex.'); + testString: assert(code.match(/myRegex.test\(\s*myString\s*\)/)); - text: Your result should return true. - testString: assert(result === true, 'Your result should return true.'); + testString: assert(result === true); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.english.md index ac33dba8a2..8d7bc4d7e5 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.english.md @@ -31,11 +31,11 @@ Apply the .match() method to extract the word coding. ```yml tests: - text: The result should have the word coding - testString: assert(result.join() === "coding", 'The result should have the word coding'); + testString: assert(result.join() === "coding"); - text: Your regex codingRegex should search for coding - testString: assert(codingRegex.source === "coding", 'Your regex codingRegex should search for coding'); + testString: assert(codingRegex.source === "coding"); - text: You should use the .match() method. - testString: assert(code.match(/\.match\(.*\)/), 'You should use the .match() method.'); + testString: assert(code.match(/\.match\(.*\)/)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching.english.md index c5d5790851..6be318033a 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching.english.md @@ -24,7 +24,7 @@ Fix the regex /<.*>/ to return the HTML tag <h1>< ```yml tests: - text: The result variable should be an array with <h1> in it - testString: assert(result[0] == '

', 'The result variable should be an array with <h1> in it'); + testString: assert(result[0] == '

'); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.english.md index 52bbf57418..b00d2be0ba 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.english.md @@ -37,13 +37,13 @@ Using the regex starRegex, find and extract both "Twinkle"starRegex should use the global flag g - testString: assert(starRegex.flags.match(/g/).length == 1, 'Your regex starRegex should use the global flag g'); + testString: assert(starRegex.flags.match(/g/).length == 1); - text: Your regex starRegex should use the case insensitive flag i - testString: assert(starRegex.flags.match(/i/).length == 1, 'Your regex starRegex should use the case insensitive flag i'); + testString: assert(starRegex.flags.match(/i/).length == 1); - text: Your match should match both occurrences of the word "Twinkle" - testString: assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), 'Your match should match both occurrences of the word "Twinkle"'); + testString: assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join()); - text: Your match result should have two elements in it. - testString: assert(result.length == 2, 'Your match result should have two elements in it.'); + testString: assert(result.length == 2); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.english.md index f8b34252d3..cc8cfda857 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.english.md @@ -39,19 +39,19 @@ Write a greedy regex that finds one or more criminals within a grou ```yml tests: - text: Your regex should match one criminal (C) in "C" - testString: assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C', 'Your regex should match one criminal (C) in "C"'); + testString: assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C'); - text: Your regex should match two criminals (CC) in "CC" - testString: assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC', 'Your regex should match two criminals (CC) in "CC"'); + testString: assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC'); - text: Your regex should match three criminals (CCC) in "P1P5P4CCCP2P6P3" - testString: assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC', 'Your regex should match three criminals (CCC) in "P1P5P4CCCP2P6P3"'); + testString: assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC'); - text: Your regex should match five criminals (CCCCC) in "P6P2P7P4P5CCCCCP3P1" - testString: assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC', 'Your regex should match five criminals (CCCCC) in "P6P2P7P4P5CCCCCP3P1"'); + testString: assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC'); - text: Your regex should not match any criminals in "" - testString: assert(!reCriminals.test(''), 'Your regex should not match any criminals in ""'); + testString: assert(!reCriminals.test('')); - text: Your regex should not match any criminals in "P1P2P3" - testString: assert(!reCriminals.test('P1P2P3'), 'Your regex should not match any criminals in "P1P2P3"'); + testString: assert(!reCriminals.test('P1P2P3')); - text: Your regex should match fifty criminals (CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC) in "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3". - testString: assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", 'Your regex should match fifty criminals (CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC) in "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".'); + testString: assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.english.md index 345c3475f0..fe3ed07d11 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.english.md @@ -22,25 +22,25 @@ Write a regex fccRegex to match "freeCodeCamp", no mat ```yml tests: - text: Your regex should match freeCodeCamp - testString: assert(fccRegex.test('freeCodeCamp'), 'Your regex should match freeCodeCamp'); + testString: assert(fccRegex.test('freeCodeCamp')); - text: Your regex should match FreeCodeCamp - testString: assert(fccRegex.test('FreeCodeCamp'), 'Your regex should match FreeCodeCamp'); + testString: assert(fccRegex.test('FreeCodeCamp')); - text: Your regex should match FreecodeCamp - testString: assert(fccRegex.test('FreecodeCamp'), 'Your regex should match FreecodeCamp'); + testString: assert(fccRegex.test('FreecodeCamp')); - text: Your regex should match FreeCodecamp - testString: assert(fccRegex.test('FreeCodecamp'), 'Your regex should match FreeCodecamp'); + testString: assert(fccRegex.test('FreeCodecamp')); - text: Your regex should not match Free Code Camp - testString: assert(!fccRegex.test('Free Code Camp'), 'Your regex should not match Free Code Camp'); + testString: assert(!fccRegex.test('Free Code Camp')); - text: Your regex should match FreeCOdeCamp - testString: assert(fccRegex.test('FreeCOdeCamp'), 'Your regex should match FreeCOdeCamp'); + testString: assert(fccRegex.test('FreeCOdeCamp')); - text: Your regex should not match FCC - testString: assert(!fccRegex.test('FCC'), 'Your regex should not match FCC'); + testString: assert(!fccRegex.test('FCC')); - text: Your regex should match FrEeCoDeCamp - testString: assert(fccRegex.test('FrEeCoDeCamp'), 'Your regex should match FrEeCoDeCamp'); + testString: assert(fccRegex.test('FrEeCoDeCamp')); - text: Your regex should match FrEeCodECamp - testString: assert(fccRegex.test('FrEeCodECamp'), 'Your regex should match FrEeCodECamp'); + testString: assert(fccRegex.test('FrEeCodECamp')); - text: Your regex should match FReeCodeCAmp - testString: assert(fccRegex.test('FReeCodeCAmp'), 'Your regex should match FReeCodeCAmp'); + testString: assert(fccRegex.test('FReeCodeCAmp')); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.english.md index f85be32e72..584b6d8a09 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.english.md @@ -23,19 +23,19 @@ Complete the regex petRegex to match the pets "dog", < ```yml tests: - text: Your regex petRegex should return true for the string "John has a pet dog." - testString: assert(petRegex.test('John has a pet dog.'), 'Your regex petRegex should return true for the string "John has a pet dog."'); + testString: assert(petRegex.test('John has a pet dog.')); - text: Your regex petRegex should return false for the string "Emma has a pet rock." - testString: assert(!petRegex.test('Emma has a pet rock.'), 'Your regex petRegex should return false for the string "Emma has a pet rock."'); + testString: assert(!petRegex.test('Emma has a pet rock.')); - text: Your regex petRegex should return true for the string "Emma has a pet bird." - testString: assert(petRegex.test('Emma has a pet bird.'), 'Your regex petRegex should return true for the string "Emma has a pet bird."'); + testString: assert(petRegex.test('Emma has a pet bird.')); - text: Your regex petRegex should return true for the string "Liz has a pet cat." - testString: assert(petRegex.test('Liz has a pet cat.'), 'Your regex petRegex should return true for the string "Liz has a pet cat."'); + testString: assert(petRegex.test('Liz has a pet cat.')); - text: Your regex petRegex should return false for the string "Kara has a pet dolphin." - testString: assert(!petRegex.test('Kara has a pet dolphin.'), 'Your regex petRegex should return false for the string "Kara has a pet dolphin."'); + testString: assert(!petRegex.test('Kara has a pet dolphin.')); - text: Your regex petRegex should return true for the string "Alice has a pet fish." - testString: assert(petRegex.test('Alice has a pet fish.'), 'Your regex petRegex should return true for the string "Alice has a pet fish."'); + testString: assert(petRegex.test('Alice has a pet fish.')); - text: Your regex petRegex should return false for the string "Jimmy has a pet computer." - testString: assert(!petRegex.test('Jimmy has a pet computer.'), 'Your regex petRegex should return false for the string "Jimmy has a pet computer."'); + testString: assert(!petRegex.test('Jimmy has a pet computer.')); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.english.md index 06e8e5834f..4039519146 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.english.md @@ -34,17 +34,17 @@ Use the shorthand character class \w to count the number of alphanu ```yml tests: - text: Your regex should use the global flag. - testString: assert(alphabetRegexV2.global, 'Your regex should use the global flag.'); - - text: Your regex should use the shorthand character - testString: assert(/\\w/.test(alphabetRegexV2.source), 'Your regex should use the shorthand character \w to match all characters which are alphanumeric.'); + testString: assert(alphabetRegexV2.global); + - text: Your regex should use the shorthand character \w to match all characters which are alphanumeric. + testString: assert(/\\w/.test(alphabetRegexV2.source)); - text: Your regex should find 31 alphanumeric characters in "The five boxing wizards jump quickly." - testString: assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31, 'Your regex should find 31 alphanumeric characters in "The five boxing wizards jump quickly."'); + testString: assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31); - text: Your regex should find 32 alphanumeric characters in "Pack my box with five dozen liquor jugs." - testString: assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32, 'Your regex should find 32 alphanumeric characters in "Pack my box with five dozen liquor jugs."'); + testString: assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32); - text: Your regex should find 30 alphanumeric characters in "How vexingly quick daft zebras jump!" - testString: assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30, 'Your regex should find 30 alphanumeric characters in "How vexingly quick daft zebras jump!"'); + testString: assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30); - text: Your regex should find 36 alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ." - testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36, 'Your regex should find 36 alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."'); + testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.english.md index 3310874556..2db3214f8c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.english.md @@ -21,19 +21,19 @@ Use the shorthand character class for non-digits \D to count how ma ```yml tests: - text: Your regex should use the shortcut character to match non-digit characters - testString: assert(/\\D/.test(noNumRegex.source), 'Your regex should use the shortcut character to match non-digit characters'); + testString: assert(/\\D/.test(noNumRegex.source)); - text: Your regex should use the global flag. - testString: assert(noNumRegex.global, 'Your regex should use the global flag.'); + testString: assert(noNumRegex.global); - text: Your regex should find no non-digits in "9". - testString: assert("9".match(noNumRegex) == null, 'Your regex should find no non-digits in "9".'); + testString: assert("9".match(noNumRegex) == null); - text: Your regex should find 6 non-digits in "Catch 22". - testString: assert("Catch 22".match(noNumRegex).length == 6, 'Your regex should find 6 non-digits in "Catch 22".'); + testString: assert("Catch 22".match(noNumRegex).length == 6); - text: Your regex should find 11 non-digits in "101 Dalmatians". - testString: assert("101 Dalmatians".match(noNumRegex).length == 11, 'Your regex should find 11 non-digits in "101 Dalmatians".'); + testString: assert("101 Dalmatians".match(noNumRegex).length == 11); - text: Your regex should find 15 non-digits in "One, Two, Three". - testString: assert("One, Two, Three".match(noNumRegex).length == 15, 'Your regex should find 15 non-digits in "One, Two, Three".'); + testString: assert("One, Two, Three".match(noNumRegex).length == 15); - text: Your regex should find 12 non-digits in "21 Jump Street". - testString: assert("21 Jump Street".match(noNumRegex).length == 12, 'Your regex should find 12 non-digits in "21 Jump Street".'); + testString: assert("21 Jump Street".match(noNumRegex).length == 12); - text: 'Your regex should find 17 non-digits in "2001: A Space Odyssey".' testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17, ''Your regex should find 17 non-digits in "2001: A Space Odyssey".'');' diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.english.md index 0df09fde20..60b4baa20b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.english.md @@ -21,19 +21,19 @@ Use the shorthand character class \d to count how many digits are i ```yml tests: - text: Your regex should use the shortcut character to match digit characters - testString: assert(/\\d/.test(numRegex.source), 'Your regex should use the shortcut character to match digit characters'); + testString: assert(/\\d/.test(numRegex.source)); - text: Your regex should use the global flag. - testString: assert(numRegex.global, 'Your regex should use the global flag.'); + testString: assert(numRegex.global); - text: Your regex should find 1 digit in "9". - testString: assert("9".match(numRegex).length == 1, 'Your regex should find 1 digit in "9".'); + testString: assert("9".match(numRegex).length == 1); - text: Your regex should find 2 digits in "Catch 22". - testString: assert("Catch 22".match(numRegex).length == 2, 'Your regex should find 2 digits in "Catch 22".'); + testString: assert("Catch 22".match(numRegex).length == 2); - text: Your regex should find 3 digits in "101 Dalmatians". - testString: assert("101 Dalmatians".match(numRegex).length == 3, 'Your regex should find 3 digits in "101 Dalmatians".'); + testString: assert("101 Dalmatians".match(numRegex).length == 3); - text: Your regex should find no digits in "One, Two, Three". - testString: assert("One, Two, Three".match(numRegex) == null, 'Your regex should find no digits in "One, Two, Three".'); + testString: assert("One, Two, Three".match(numRegex) == null); - text: Your regex should find 2 digits in "21 Jump Street". - testString: assert("21 Jump Street".match(numRegex).length == 2, 'Your regex should find 2 digits in "21 Jump Street".'); + testString: assert("21 Jump Street".match(numRegex).length == 2); - text: 'Your regex should find 4 digits in "2001: A Space Odyssey".' testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4, ''Your regex should find 4 digits in "2001: A Space Odyssey".'');' diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.english.md index 61fc9b73cf..0f355b4ed3 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.english.md @@ -30,25 +30,25 @@ Complete the regex unRegex so that it matches the strings "ru ```yml tests: - text: You should use the .test() method. - testString: assert(code.match(/\.test\(.*\)/), 'You should use the .test() method.'); + testString: assert(code.match(/\.test\(.*\)/)); - text: You should use the wildcard character in your regex unRegex - testString: assert(/\./.test(unRegex.source), 'You should use the wildcard character in your regex unRegex'); + testString: assert(/\./.test(unRegex.source)); - text: Your regex unRegex should match "run" in "Let us go on a run." - testString: assert(unRegex.test("Let us go on a run."), 'Your regex unRegex should match "run" in "Let us go on a run."'); + testString: assert(unRegex.test("Let us go on a run.")); - text: Your regex unRegex should match "sun" in "The sun is out today." - testString: assert(unRegex.test("The sun is out today."), 'Your regex unRegex should match "sun" in "The sun is out today."'); + testString: assert(unRegex.test("The sun is out today.")); - text: Your regex unRegex should match "fun" in "Coding is a lot of fun." - testString: assert(unRegex.test("Coding is a lot of fun."), 'Your regex unRegex should match "fun" in "Coding is a lot of fun."'); + testString: assert(unRegex.test("Coding is a lot of fun.")); - text: Your regex unRegex should match "pun" in "Seven days without a pun makes one weak." - testString: assert(unRegex.test("Seven days without a pun makes one weak."), 'Your regex unRegex should match "pun" in "Seven days without a pun makes one weak."'); + testString: assert(unRegex.test("Seven days without a pun makes one weak.")); - text: Your regex unRegex should match "nun" in "One takes a vow to be a nun." - testString: assert(unRegex.test("One takes a vow to be a nun."), 'Your regex unRegex should match "nun" in "One takes a vow to be a nun."'); + testString: assert(unRegex.test("One takes a vow to be a nun.")); - text: Your regex unRegex should match "bun" in "She got fired from the hot dog stand for putting her hair in a bun." - testString: assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."), 'Your regex unRegex should match "bun" in "She got fired from the hot dog stand for putting her hair in a bun."'); + testString: assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun.")); - text: Your regex unRegex should not match "There is a bug in my code." - testString: assert(!unRegex.test("There is a bug in my code."), 'Your regex unRegex should not match "There is a bug in my code."'); + testString: assert(!unRegex.test("There is a bug in my code.")); - text: Your regex unRegex should not match "Catch me if you can." - testString: assert(!unRegex.test("Can me if you can."), 'Your regex unRegex should not match "Catch me if you can."'); + testString: assert(!unRegex.test("Can me if you can.")); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.english.md index 03c9547b7d..d3e286b974 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.english.md @@ -32,13 +32,13 @@ Use the caret character in a regex to find "Cal" only ```yml tests: - text: Your regex should search for "Cal" with a capital letter. - testString: assert(calRegex.source == "^Cal", 'Your regex should search for "Cal" with a capital letter.'); + testString: assert(calRegex.source == "^Cal"); - text: Your regex should not use any flags. - testString: assert(calRegex.flags == "", 'Your regex should not use any flags.'); + testString: assert(calRegex.flags == ""); - text: Your regex should match "Cal" at the beginning of the string. - testString: assert(calRegex.test("Cal and Ricky both like racing."), 'Your regex should match "Cal" at the beginning of the string.'); + testString: assert(calRegex.test("Cal and Ricky both like racing.")); - text: Your regex should not match "Cal" in the middle of a string. - testString: assert(!calRegex.test("Ricky and Cal both like racing."), 'Your regex should not match "Cal" in the middle of a string.'); + testString: assert(!calRegex.test("Ricky and Cal both like racing.")); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.english.md index e38429625d..15a10ec7f7 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.english.md @@ -23,11 +23,11 @@ You want to find matches when the letter s occurs one or more times ```yml tests: - text: Your regex myRegex should use the + sign to match one or more s characters. - testString: assert(/\+/.test(myRegex.source), 'Your regex myRegex should use the + sign to match one or more s characters.'); + testString: assert(/\+/.test(myRegex.source)); - text: Your regex myRegex should match 2 items. - testString: assert(result.length == 2, 'Your regex myRegex should match 2 items.'); + testString: assert(result.length == 2); - text: The result variable should be an array with two matches of "ss" - testString: assert(result[0] == 'ss' && result[1] == 'ss', 'The result variable should be an array with two matches of "ss"'); + testString: assert(result[0] == 'ss' && result[1] == 'ss'); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.english.md index 5ba1b8fd03..3c3e008e28 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.english.md @@ -33,11 +33,11 @@ Use the anchor character ($) to match the string "caboose""caboose" with the dollar sign $ anchor in your regex. - testString: assert(lastRegex.source == "caboose$", 'You should search for "caboose" with the dollar sign $ anchor in your regex.'); + testString: assert(lastRegex.source == "caboose$"); - text: Your regex should not use any flags. - testString: assert(lastRegex.flags == "", 'Your regex should not use any flags.'); + testString: assert(lastRegex.flags == ""); - text: You should match "caboose" at the end of the string "The last car on a train is the caboose" - testString: assert(lastRegex.test("The last car on a train is the caboose"), 'You should match "caboose" at the end of the string "The last car on a train is the caboose"'); + testString: assert(lastRegex.test("The last car on a train is the caboose")); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.english.md index b1adc09001..266fb5401c 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.english.md @@ -30,17 +30,17 @@ Use the shorthand character class \W to count the number of non-alp ```yml tests: - text: Your regex should use the global flag. - testString: assert(nonAlphabetRegex.global, 'Your regex should use the global flag.'); + testString: assert(nonAlphabetRegex.global); - text: Your regex should find 6 non-alphanumeric characters in "The five boxing wizards jump quickly.". - testString: assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6, 'Your regex should find 6 non-alphanumeric characters in "The five boxing wizards jump quickly.".'); - - text: Your regex should use the shorthand character. - testString: assert(/\\W/.test(nonAlphabetRegex.source), 'Your regex should use the shorthand character to match characters which are non-alphanumeric.'); + testString: assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6); + - text: Your regex should use the shorthand character to match characters which are non-alphanumeric. + testString: assert(/\\W/.test(nonAlphabetRegex.source)); - text: Your regex should find 8 non-alphanumeric characters in "Pack my box with five dozen liquor jugs." - testString: assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8, 'Your regex should find 8 non-alphanumeric characters in "Pack my box with five dozen liquor jugs."'); + testString: assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8); - text: Your regex should find 6 non-alphanumeric characters in "How vexingly quick daft zebras jump!" - testString: assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6, 'Your regex should find 6 non-alphanumeric characters in "How vexingly quick daft zebras jump!"'); + testString: assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6); - text: Your regex should find 12 non-alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ." - testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12, 'Your regex should find 12 non-alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."'); + testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.english.md index 41c479a2b8..a699ab5eca 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.english.md @@ -34,11 +34,11 @@ Match all the letters in the string quoteSample. ```yml tests: - text: Your regex alphabetRegex should match 35 items. - testString: assert(result.length == 35, 'Your regex alphabetRegex should match 35 items.'); + testString: assert(result.length == 35); - text: Your regex alphabetRegex should use the global flag. - testString: assert(alphabetRegex.flags.match(/g/).length == 1, 'Your regex alphabetRegex should use the global flag.'); + testString: assert(alphabetRegex.flags.match(/g/).length == 1); - text: Your regex alphabetRegex should use the case insensitive flag. - testString: assert(alphabetRegex.flags.match(/i/).length == 1, 'Your regex alphabetRegex should use the case insensitive flag.'); + testString: assert(alphabetRegex.flags.match(/i/).length == 1); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.english.md index b7210cc879..175a339583 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.english.md @@ -37,11 +37,11 @@ Complete the regex waldoRegex to find "Waldo" in the s ```yml tests: - text: Your regex waldoRegex should find "Waldo" - testString: assert(waldoRegex.test(waldoIsHiding), 'Your regex waldoRegex should find "Waldo"'); + testString: assert(waldoRegex.test(waldoIsHiding)); - text: Your regex waldoRegex should not search for anything else. - testString: assert(!waldoRegex.test('Somewhere is hiding in this text.'), 'Your regex waldoRegex should not search for anything else.'); + testString: assert(!waldoRegex.test('Somewhere is hiding in this text.')); - text: You should perform a literal string match with your regex. - testString: assert(!/\/.*\/i/.test(code), 'You should perform a literal string match with your regex.'); + testString: assert(!/\/.*\/i/.test(code)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.english.md index d93f4c44ce..767647f27b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.english.md @@ -28,15 +28,15 @@ Change the regex countNonWhiteSpace to look for multiple non-whites ```yml tests: - text: Your regex should use the global flag. - testString: assert(countNonWhiteSpace.global, 'Your regex should use the global flag.'); - - text: Your regex should use the shorthand character - testString: assert(/\\S/.test(countNonWhiteSpace.source), 'Your regex should use the shorthand character \S/code> to match all non-whitespace characters.'); + testString: assert(countNonWhiteSpace.global); + - text: Your regex should use the shorthand character \S/code> to match all non-whitespace characters. + testString: assert(/\\S/.test(countNonWhiteSpace.source)); - text: Your regex should find 35 non-spaces in "Men are from Mars and women are from Venus." - testString: assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35, 'Your regex should find 35 non-spaces in "Men are from Mars and women are from Venus."'); + testString: assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35); - text: 'Your regex should find 23 non-spaces in "Space: the final frontier."' testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23, ''Your regex should find 23 non-spaces in "Space: the final frontier."'');' - text: Your regex should find 21 non-spaces in "MindYourPersonalSpace" - testString: assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21, 'Your regex should find 21 non-spaces in "MindYourPersonalSpace"'); + testString: assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.english.md index f86b2427e2..691b119052 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.english.md @@ -30,11 +30,11 @@ Create a single regex that matches a range of letters between h and ```yml tests: - text: Your regex myRegex should match 17 items. - testString: assert(result.length == 17, 'Your regex myRegex should match 17 items.'); + testString: assert(result.length == 17); - text: Your regex myRegex should use the global flag. - testString: assert(myRegex.flags.match(/g/).length == 1, 'Your regex myRegex should use the global flag.'); + testString: assert(myRegex.flags.match(/g/).length == 1); - text: Your regex myRegex should use the case insensitive flag. - testString: assert(myRegex.flags.match(/i/).length == 1, 'Your regex myRegex should use the case insensitive flag.'); + testString: assert(myRegex.flags.match(/i/).length == 1); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.english.md index d161031c25..4c46cac1fe 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.english.md @@ -36,15 +36,15 @@ Use a character class with vowels (a, e, ivowelRegex should use a character class. - testString: assert(/\[.*\]/.test(vowelRegex.source), 'Your regex vowelRegex should use a character class.'); + testString: assert(/\[.*\]/.test(vowelRegex.source)); - text: Your regex vowelRegex should use the global flag. - testString: assert(vowelRegex.flags.match(/g/).length == 1, 'Your regex vowelRegex should use the global flag.'); + testString: assert(vowelRegex.flags.match(/g/).length == 1); - text: Your regex vowelRegex should use the case insensitive flag. - testString: assert(vowelRegex.flags.match(/i/).length == 1, 'Your regex vowelRegex should use the case insensitive flag.'); + testString: assert(vowelRegex.flags.match(/i/).length == 1); - text: Your regex should not match any consonants. - testString: assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()), 'Your regex should not match any consonants.'); + testString: assert(!/[b-df-hj-np-tv-z]/gi.test(result.join())); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.english.md index ecd4ab52f2..40a50bf645 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.english.md @@ -22,11 +22,11 @@ Create a single regex that matches all characters that are not a number or a vow ```yml tests: - text: Your regex myRegex should match 9 items. - testString: assert(result.length == 9, 'Your regex myRegex should match 9 items.'); + testString: assert(result.length == 9); - text: Your regex myRegex should use the global flag. - testString: assert(myRegex.flags.match(/g/).length == 1, 'Your regex myRegex should use the global flag.'); + testString: assert(myRegex.flags.match(/g/).length == 1); - text: Your regex myRegex should use the case insensitive flag. - testString: assert(myRegex.flags.match(/i/).length == 1, 'Your regex myRegex should use the case insensitive flag.'); + testString: assert(myRegex.flags.match(/i/).length == 1); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.english.md index 99653cd438..de4d6cb48f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.english.md @@ -29,15 +29,15 @@ Change the regex countWhiteSpace to look for multiple whitespace ch ```yml tests: - text: Your regex should use the global flag. - testString: assert(countWhiteSpace.global, 'Your regex should use the global flag.'); - - text: Your regex should use the shorthand character - testString: assert(/\\s/.test(countWhiteSpace.source), 'Your regex should use the shorthand character \s to match all whitespace characters.'); + testString: assert(countWhiteSpace.global); + - text: Your regex should use the shorthand character \s to match all whitespace characters. + testString: assert(/\\s/.test(countWhiteSpace.source)); - text: Your regex should find eight spaces in "Men are from Mars and women are from Venus." - testString: assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8, 'Your regex should find eight spaces in "Men are from Mars and women are from Venus."'); + testString: assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8); - text: 'Your regex should find three spaces in "Space: the final frontier."' testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3, ''Your regex should find three spaces in "Space: the final frontier."'');' - text: Your regex should find no spaces in "MindYourPersonalSpace" - testString: assert("MindYourPersonalSpace".match(countWhiteSpace) == null, 'Your regex should find no spaces in "MindYourPersonalSpace"'); + testString: assert("MindYourPersonalSpace".match(countWhiteSpace) == null); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.english.md index a3e3f49816..2eb5157060 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.english.md @@ -42,21 +42,21 @@ Use lookaheads in the pwRegex to match passwords that ```yml tests: - text: Your regex should use two positive lookaheads. - testString: assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null, 'Your regex should use two positive lookaheads.'); + testString: assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null); - text: Your regex should not match "astronaut" - testString: assert(!pwRegex.test("astronaut"), 'Your regex should not match "astronaut"'); + testString: assert(!pwRegex.test("astronaut")); - text: Your regex should not match "airplanes" - testString: assert(!pwRegex.test("airplanes"), 'Your regex should not match "airplanes"'); + testString: assert(!pwRegex.test("airplanes")); - text: Your regex should not match "banan1" - testString: assert(!pwRegex.test("banan1"), 'Your regex should not match "banan1"'); + testString: assert(!pwRegex.test("banan1")); - text: Your regex should match "bana12" - testString: assert(pwRegex.test("bana12"), 'Your regex should match "bana12"'); + testString: assert(pwRegex.test("bana12")); - text: Your regex should match "abc123" - testString: assert(pwRegex.test("abc123"), 'Your regex should match "abc123"'); + testString: assert(pwRegex.test("abc123")); - text: Your regex should not match "123" - testString: assert(!pwRegex.test("123"), 'Your regex should not match "123"'); + testString: assert(!pwRegex.test("123")); - text: Your regex should not match "1234" - testString: assert(!pwRegex.test("1234"), 'Your regex should not match "1234"'); + testString: assert(!pwRegex.test("1234")); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md index 946e41830a..f5cd04837d 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.english.md @@ -21,11 +21,11 @@ Write a regex and use the appropriate string methods to remove whitespace at the ```yml tests: - text: result should equal to "Hello, World!" - testString: assert(result == "Hello, World!", 'result should equal to "Hello, World!"'); + testString: assert(result == "Hello, World!"); - text: You should not use the .trim() method. - testString: assert(!code.match(/\.trim\(.*?\)/), 'You should not use the .trim() method.'); + testString: assert(!code.match(/\.trim\(.*?\)/)); - text: The result variable should not be set equal to a string. - testString: assert(!code.match(/result\s*=\s*".*?"/), 'The result variable should not be set equal to a string.'); + testString: assert(!code.match(/result\s*=\s*".*?"/)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md index 2cd7afac30..37be412703 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.english.md @@ -33,17 +33,17 @@ Change the regex timRegex to match the word "Timber" o ```yml tests: - text: Your regex should use curly brackets. - testString: assert(timRegex.source.match(/{.*?}/).length > 0, 'Your regex should use curly brackets.'); + testString: assert(timRegex.source.match(/{.*?}/).length > 0); - text: Your regex should not match "Timber" - testString: assert(!timRegex.test("Timber"), 'Your regex should not match "Timber"'); + testString: assert(!timRegex.test("Timber")); - text: Your regex should not match "Timmber" - testString: assert(!timRegex.test("Timmber"), 'Your regex should not match "Timmber"'); + testString: assert(!timRegex.test("Timmber")); - text: Your regex should not match "Timmmber" - testString: assert(!timRegex.test("Timmmber"), 'Your regex should not match "Timmmber"'); + testString: assert(!timRegex.test("Timmmber")); - text: Your regex should match "Timmmmber" - testString: assert(timRegex.test("Timmmmber"), 'Your regex should match "Timmmmber"'); + testString: assert(timRegex.test("Timmmmber")); - text: Your regex should not match "Timber" with 30 m's in it. - testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"), 'Your regex should not match "Timber" with 30 m\'s in it.'); + testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber")); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.english.md index 9bb8d75f49..45040e009f 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.english.md @@ -36,11 +36,11 @@ Write a regex so that it will search for the string "good". Then up ```yml tests: - text: You should use .replace() to search and replace. - testString: assert(code.match(/\.replace\(.*\)/), 'You should use .replace() to search and replace.'); + testString: assert(code.match(/\.replace\(.*\)/)); - text: Your regex should change "This sandwich is good." to "This sandwich is okey-dokey." - testString: assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey", 'Your regex should change "This sandwich is good." to "This sandwich is okey-dokey."'); + testString: assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey"); - text: You should not change the last line. - testString: assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/), 'You should not change the last line.'); + testString: assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/)); ``` diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.english.md index 6b1fa9263f..b259cf37a1 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.english.md @@ -30,9 +30,9 @@ Apply the regex myRegex on the string myString using t ```yml tests: - text: You should use .test() to test the regex. - testString: assert(code.match(/myRegex.test\(\s*myString\s*\)/), 'You should use .test() to test the regex.'); + testString: assert(code.match(/myRegex.test\(\s*myString\s*\)/)); - text: Your result should return true. - testString: assert(result === true, 'Your result should return true.'); + testString: assert(result === true); ```