mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-26 03:42:38 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
	
		
			447 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
	
		
			447 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("reassignment to const", () => {
 | |
|     const constantValue = 1;
 | |
|     expect(() => {
 | |
|         constantValue = 2;
 | |
|     }).toThrowWithMessage(TypeError, "Invalid assignment to const variable");
 | |
|     expect(constantValue).toBe(1);
 | |
| });
 | |
| 
 | |
| test("const creation in inner scope", () => {
 | |
|     const constantValue = 1;
 | |
|     do {
 | |
|         const constantValue = 2;
 | |
|         expect(constantValue).toBe(2);
 | |
|     } while (false);
 | |
|     expect(constantValue).toBe(1);
 | |
| });
 | 
