The problem is that you're using | instead of ||. The one you're using, bitwise OR, converts the left and right operands to numbers, then applies the operation to those values.
The distinguishing factor is this: bitwise operations perform operations on the bits, thus the operands are converted to numbers and the operations are performed on the bits. Logical operations perform operations logically, not on the bits themselves, but the data.
Thus:
'fgfdds' | ''
Is actually using ToInt32 internally to convert 'fgfdds' and '' to a number. Both come up to be NaN, and the method ToInt32 returns +0 if the result is NaN. Thus, you're doing this:
0 | 0
Which is 0 because both operands are 0. Using logical OR, or ||, does not convert the operands to numbers and logically evaluates the operands. If one operand or the other is defined or not falsey, then it evaluates to that operand. Thus, try this:
this.title = title || '';
This will evaluate to this.title if this.title is defined or truthy, and an empty string otherwise. See logical operators and bitwise operators at MDN.
Also, if you're using ECMAScript 2015, try using default parameters instead which is a much nicer way to do this:
constructor(title = '', date = '01-01-00', content = '', photoURL = '../images/image.png') {
...
}
||, not|.