![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 42 Pomógł: 3 Dołączył: 10.02.2010 Ostrzeżenie: (0%) ![]() ![]() |
Mam sobie taki kod:
Kod function Screen(id, diagonal, x_resolution, y_resolution) { this.id = id; this.diagonal = diagonal; this.x_resolution = x_resolution; this.y_resolution = y_resolution; // tutaj reszta konstruktora } Screen.prototype.update = function(diagonal, x_resolution, y_resolution) { this = new Screen(this.id, diagonal, x_resolution, y_resolution); } I nie działa (czego się spodziewałem:)). Kod invalid assignment left-hand side [Break on this error] this = new Screen(this.id, diagonal, x_resolution, y_resolution);\n Chcę napisać metodę, która będzie aktualizowała obiekt po wprowadzeniu nowych danych, właśnie przez wywołanie konstruktora. Wie ktoś jak to ładnie (i skutecznie:D) zrobić? Ten post edytował ciembor 4.12.2010, 04:57:31 -------------------- Blog Macieja Ciemborowicza
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 19.08.2025 - 21:18 |